fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. string str_input;
  8. cin >> str_input;
  9.  
  10. if (str_input.length() < 6) {
  11. cout << "Invalid input" << endl;
  12. return 1;
  13. }
  14.  
  15. int saleh = 0;
  16. int moayed = 0;
  17.  
  18. for (int i = 0; i < 3; i++) {
  19. saleh += int(str_input[i]);
  20. moayed += int(str_input[i+3]);
  21. }
  22.  
  23. if (saleh == moayed) {
  24. cout << "YES" << endl;
  25. } else {
  26. cout << "NO" << endl;
  27. }
  28.  
  29. return 0;
  30. }
  31.  
Success #stdin #stdout 0.01s 5284KB
stdin
055776
stdout
NO