#line 1 "main.cpp" #include #include #include #include using namespace std; const vector> dxys{{0, -1}, {1, 0}, {-1, 0}, {0, 1}, {1, 0}, {-1, 0}}; void solve() { string s; cin >> s; set> ss; int x = 0, y = 0; ss.emplace(x, y); for (char c : s) { int i = (c - 'a') * 2 + x; if (y % 2 != 0) i += 3; auto [dx, dy] = dxys[(i % 6 + 6) % 6]; x += dx, y += dy; ss.emplace(x, y); } cout << ss.size() << "\n"; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); solve(); return 0; }