Amazon Interview Question

Given a string, remove redundant spaces.