#include using namespace std; class point { double x; double y; public: point(double x, double y) { this->x = x; this->y = y; } point() { this->x = 0; this->y = 0; } point operator+(const point &p) const { return point(x + p.x, y + p.y); } point operator-(const point &p) const { return point(x - p.x, y - p.y); } bool operator<(const point &p) const { if (this->x != p.x) return this->x < p.x; return this->y < p.y; } }; int main() { ios_base::sync_with_stdio(0); cin.tie(0); string s; cin >> s; tuple cur(point(0, 0.5), point(0, 0), point(1, 0)); set > t; t.insert(cur); for (char c: s) { point A, B, C; tie(A, B, C) = cur; if (c == 'a') A = B + C - A; else if (c == 'b') B = C + A - B; else C = A + B - C; cur = tuple(A, B, C); t.insert(cur); } cout << t.size() << endl; return 0; }