Advertisement
CLazStudio

q199024209

Mar 15th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, x, s;
  8.     cin >> n;
  9.  
  10.     x = n % 10;
  11.     n /= 10;
  12.     s = 0;
  13.  
  14.     while (n > 0)
  15.     {
  16.         if (n % 10 == x) s++;
  17.         n /= 10;
  18.     }
  19.  
  20.     cout << s;
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement