Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long int ll;
- #define MAX 1000000007
- #define pb push_backs
- ll mini=1e9+7;
- multiset<string>mp;
- int main()
- { ios_base::sync_with_stdio(false);
- ll t;
- cin>>t;
- while(t--)
- {
- mp.clear();
- string s,temp="cefh",var,c;
- cin>>s;
- ll ans=0;
- if(s.length()<4)
- {
- cout<<"normal"<<'\n';
- continue;
- }
- else
- {
- for(ll i=0;i<s.length()-3;i++)
- {
- c=s.substr(i,4);
- // cout<<c<<'\n';
- mp.insert(c);
- }
- while(next_permutation(temp.begin(),temp.end())) // while there exists a permutation
- {
- if(mp.find(temp)!=mp.end())
- {
- ans++;
- }
- }
- }
- (ans==0)?cout<<"normal"<<'\n':cout<<"lovely "<<ans<<'\n';
- }
- }
Add Comment
Please, Sign In to add comment