#include <bits/stdc++.h>   using namespace std;   int main() {     int i = 0, a = 0, b = 0, c = 0;     string s;     cin >> s;     for (; i < s.length(); i++) {       if (s[i] ==  a )         a++;       else         break;     }     for (; i < s.length(); i++) {       if (s[i] ==  b )         b++;       else         break;     }     for (; i < s.length(); i++) {       if (s[i] ==  c )         c++;       else         break;     }     if (i != s.length() || (c != a && c != b) || a == 0 || b == 0)       cout <<  NO  << endl;     else       cout <<  YES  << endl;     return 0;   }   