Guest User

Untitled

a guest
Feb 14th, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. typedef long long int ll;
  4. #define MAX 1000000007
  5. #define pb push_backs
  6. ll mini=1e9+7;
  7. multiset<string>mp;
  8.  
  9. int main()
  10. {   ios_base::sync_with_stdio(false);
  11.     ll t;
  12.     cin>>t;
  13.     while(t--)
  14.     {
  15.         mp.clear();
  16.         string s,temp="cefh",var,c;
  17.         cin>>s;
  18.         ll ans=0;
  19.         if(s.length()<4)
  20.         {
  21.             cout<<"normal"<<'\n';
  22.             continue;
  23.         }
  24.         else
  25.         {
  26.         for(ll i=0;i<s.length()-3;i++)
  27.         {
  28.             c=s.substr(i,4);
  29.         //  cout<<c<<'\n';
  30.             mp.insert(c);      
  31.         }  
  32.         while(next_permutation(temp.begin(),temp.end()))  // while there exists a permutation
  33.         {
  34.             if(mp.find(temp)!=mp.end())
  35.             {
  36.                 ans++;
  37.             }
  38.         }
  39.     }
  40.             (ans==0)?cout<<"normal"<<'\n':cout<<"lovely "<<ans<<'\n';
  41.      }  
  42. }
Add Comment
Please, Sign In to add comment