Rosetta Problems

Strings of Eternity

https://atcoder.jp/contests/abc135/tasks/abc135_f