daily pastebin goal
66%
SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.     //freopen("input.txt","r",stdin);
  6.     //freopen("output.txt","w",stdout);
  7.     string s1, s2;
  8.     int tc;
  9.     cin>>tc;
  10.     cin.ignore();
  11.     for(int cas=1; cas<=tc; cas++) {
  12.         getline(cin,s1);
  13.         getline(cin,s2);
  14.  
  15.         for(int i = 0; i<s1.size(); i++)if(s1[i]==' ')s1.erase(i,1);
  16.         for(int i = 0; i<s1.size(); i++)s1[i] = tolower(s1[i]);
  17.         for(int i = 0; i<s2.size(); i++)if(s2[i]==' ')s2.erase(i,1);
  18.         for(int i = 0; i<s2.size(); i++)s2[i] = tolower(s2[i]);
  19.  
  20.         sort(s1.begin(),s1.end());
  21.         sort(s2.begin(),s2.end());
  22.  
  23.         cout << "Case " << cas << ": ";
  24.         if(s1.size()<s2.size() && s2.find(s1) != string::npos) {
  25.             cout << "Yes"<<endl;
  26.         }
  27.         else if(s1.find(s2)!= string::npos) {
  28.             cout << "Yes" << endl;
  29.         }
  30.         else cout << "No" << endl;
  31.     }
  32.   return 0;
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top