Amazon Interview Question

String swapping with many constraints and many corner cases.