Amazon interview question

String swapping with many constraints and many corner cases.