#include #include #include #include #include #include #include #include #include #include #include #include #include #include #define pb push_back #define mp make_pair #define sortvi(a) sort(a.begin(), a.end()) #define FOR(i, start, final) for (int i=start; i<=final; ++i) #define ROF(i, start, final) for (int i=start; i>=final; --i) #define f cin #define g cout //void f(int &x){char k;for(k=getchar();k<= 32;k=getchar());for(x=0;'0'<=k;k=getchar())x=x*10+k-'0';} /*void f(int &x)//parsare cu semn { char k; bool semn=0; for (k = getchar(); (k>'9' || k<'0');) { if (k=='-') semn=1; k=getchar(); } for (x = 0; '0' <= k; k = getchar()) x = x * 10 + k - '0'; if (semn==1) x=-x; }*/ using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair < int, int> pi; typedef vector< int > vi; typedef vector< pair< int, int > > vpi; //ifstream f("test.in");ofstream g("test.out"); string s; int N; set < string > H; ll sol; void back(char crt) { if (crt>9) return; if (H.find(s)==H.end()) H.insert(s), ++sol; FOR(i,2,9) { s.insert(s.begin()+i, crt); char aux=++crt; back(aux); s.erase(s.begin()+i); } } int main() { f.sync_with_stdio(false); f>>s; //back('0'); FOR(i,2,9) for (char c='0'; c<='9'; ++c) { string::iterator it=s.insert(s.begin()+i, c); //g<