Rosetta Problems

String Puzzle

https://onlinejudge.u-aizu.ac.jp/problems/3548