fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. long x;
  6. int c = 0;
  7. cin >> x;
  8. while (x/10) {
  9. int t = x%10;
  10. int u = (x&100) / 10;
  11. if ((t+u)%2 == 0){
  12. c++;
  13. }
  14. x /= 10;
  15. }
  16. cout << c;
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5288KB
stdin
124235792
stdout
4