Amazon Interview Question

They asked a string question