Solve Two String Problems | Amazon Interview Question