Rosetta Problems

Alice's Magic

https://hoj.hamako-ths.ed.jp/onlinejudge/problems/579