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