#include #include using namespace std; char nr[11]; char numere[100][11]; int p, cnt; int main() { cin >> nr; strcpy(numere[p++], nr); for ( int i = 2; i <= 8; i++ ) { char aux[11]; strcpy(aux, nr); for ( int k = 9; k >= i + 1; k-- ) aux[k] = aux[k - 1]; for ( int j = 0; j <= 9; j++ ) { aux[i] = j +'0'; bool gasit = false; for ( int f = 0; f < p; f++ ) if ( strcmp(aux, numere[f]) == 0 ) gasit = true; if ( !gasit ) { cnt++; strcpy(numere[p++], aux); } // cout << aux << '\n'; } } for (int i = 0; i <= 9; i++) { char aux[11]; strcpy(aux, nr); aux[9] = i + '0'; bool gasit = false; for ( int f = 0; f< p; f++ ) if ( strcmp(aux, numere[f]) == 0 ) gasit = true; if ( !gasit ) { cnt++; strcpy(numere[p++], aux); } } for ( int i = 0; i < p; i++ ) for ( int j = i + 1; j < p; j++ ) if ( strcmp(numere[i], numere[j]) > 0 ) { char aux[11]; strcpy(aux, numere[i]); strcpy(numere[i], numere[j]); strcpy(numere[j], aux); } cout << p - 1; return 0; }