Amazon Interview Question

Accept a continuous string input and manipulate it as required.