Stripe interview question

string manipulation question and some followups