fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4. #include <cstdlib>
  5. #include <cctype>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. //Removed FIRST APPROACH code
  11.  
  12. string s1("xz");
  13. string s2("yy");
  14.  
  15. int a = 0; //counts
  16. int b = 0;
  17.  
  18. for(int i = 0; i < s1.length(); i++)
  19. if(isalnum(s1.at(i)))
  20. a += tolower(s1.at(i));
  21. for(int i = 0; i < s2.length(); i++)
  22. if(isalnum(s2.at(i)))
  23. b += tolower(s2.at(i));
  24.  
  25. cout<<boolalpha<<(a == b)<<endl<<endl;
  26.  
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
true