fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. bool compare(string s1, string s2)
  8. {
  9. transform(s1.begin(), s1.end(), s1.begin(), ::toupper);
  10. transform(s2.begin(), s2.end(), s2.begin(), ::toupper);
  11. return s1 == s2;
  12. }
  13.  
  14. int main() {
  15.  
  16. string s[] = {"sTAck", "STACk", "STAcK", "SSTTAACCKK", "stack", "Extack"};
  17.  
  18. for(int i = 0; i < 6; i++)
  19. cout << s[i] << (compare(s[i], "stack") ? " OK" : " NOK") << endl;
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
sTAck OK
STACk OK
STAcK OK
SSTTAACCKK NOK
stack OK
Extack NOK