fork download
  1. #include<iostream>
  2. #include<vector>
  3. using namespace std;
  4.  
  5. bool punyaHuruf(string s, string t){
  6. vector<int> ada(130);
  7. for(int i = 0; i < (int)t.size(); i++){
  8. ada[t[i]] = 1;
  9.  
  10. // uppercase to lowercase
  11. if('A' <= t[i] && t[i] <= 'Z')t[i] += 32;
  12.  
  13. // sebaliknya
  14. else if('a' <= t[i] && t[i] <= 'z') t[i] -= 32;
  15.  
  16. ada[t[i]] = 1;
  17. }
  18.  
  19. for(char c : s) if (!ada[c]) return false;
  20. return true;
  21. }
  22.  
  23. int main(){
  24. int tc = 3;
  25. while(tc--){
  26. string s ,t;
  27. cin >> s >> t;
  28. cout << punyaHuruf(s, t) << '\n';
  29. }
  30.  
  31. }
  32.  
  33. /*
  34. cat antarctica
  35. cat australia
  36. cat ANTARCTICA
  37. */
Success #stdin #stdout 0.01s 5320KB
stdin
cat antarctica
cat australia
cat ANTARCTICA
stdout
1
0
1