Stripe Interview Question

Coding question about string manipulation. Not super hard data structure.