-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchefchr.cpp
57 lines (48 loc) · 880 Bytes
/
chefchr.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include<iostream>
#include<cstring>
#include<math.h>
#include<iomanip>
#include<algorithm>
using namespace std;
long long int total(string s,int n)
{
string x="cefh",m="";
long long int total=0;
for(int i=0;i<n-3;i++)
{
m=s.substr(i,4);
sort(m.begin(),m.end());
if(m==x)
{
total++;
}
}
return total;
}
int main()
{
int t;
cin>>t;
while(t--)
{
string s;
cin>>s;
int len=s.length();
int x=26;
int a[x]={0};
for(int i=0;i<len;i++)
{
a[s[i]-'a']++;
}
int t=total(s,len);
if(t==0||len<4)
{
cout<<"normal"<<endl;
}
else if(a[2]>0&&a[4]>0&&a[5]>0&&a[7]>0&&t>0)
{
cout<<"lovely"<<" "<<t<<endl;
}
}
return 0;
}