fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // Introduc variabilele a, b, c şi x;
  6. int a, b, c, x;
  7. // Citesc a, b, c, x;
  8. cin >> a >> b >> c >> x;
  9. if (c == x % 10) {// verificam "c"
  10.  
  11.  
  12. // Introduc variabila “cnt” sa numar cifrele;
  13. int cnt = 0;
  14. // parcurg x;
  15. int x_copy;
  16. while (x > 0) {
  17. ++cnt;
  18. x_copy = x;// verificam "b"
  19. x /= 10;
  20.  
  21. }
  22. if (b == x_copy)
  23. cout << b;
  24. //cout << cnt;// verificam "a"
  25. }
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0.01s 5324KB
stdin
6 4 3 489643
stdout
4