Skip to content

Commit b9a2fd4

Browse files
authored
Create CHEFCHR.cpp
1 parent 22b0803 commit b9a2fd4

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Codeshef/CHEFCHR.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
int main() {
5+
int T;
6+
cin>>T;
7+
while(T--){
8+
string str;
9+
cin>>str;
10+
int nums[26],count=0;
11+
for(int i=0;i<26;i++)nums[i]=0;
12+
13+
int len=str.length();
14+
for(int i=0;i<(len-3);i++){
15+
for(int j=i;j<(i+4);j++){
16+
nums[str[j]-'a']++;
17+
}
18+
if(nums[2]==1 && nums[4]==1 && nums[5]==1 && nums[7]==1)count++;
19+
for(int i=0;i<26;i++)nums[i]=0;
20+
}
21+
22+
if(count>0)cout<<"lovely "<<count<<endl;
23+
else cout<<"normal"<<endl;
24+
}
25+
return 0;
26+
}

0 commit comments

Comments
 (0)