Codeforces Round #531 (Div. 3) D - Balanced Ternary String

NoSuchKey