kot_mapku3

2 I

Jun 2nd, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int main(){
  8.     ios::sync_with_stdio(false);
  9.     cin.tie(nullptr);
  10.    
  11.     string s;
  12.     cin >> s;
  13.  
  14.     int m = 0;
  15.     for (int i = 0; i < s.length(); ++i) {
  16.         if (s[i] == '9' || s[i] == '6' || s[i] == '4' || s[i] == '0') m++;
  17.         if (s[i] == '8') m+=2;
  18.     }
  19.  
  20.     cout << m;
  21.    
  22.     return 0;
  23. }
Add Comment
Please, Sign In to add comment