-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathChefchr.java
More file actions
39 lines (35 loc) · 991 Bytes
/
Chefchr.java
File metadata and controls
39 lines (35 loc) · 991 Bytes
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
package com.code;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
class Chefchr {
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int T=Integer.parseInt(br.readLine());
for(int j=1;j<=T;j++)
{
String str=br.readLine();
int count=0;
str=str.replaceAll("[^a-zA-Z]","");
str=str.toLowerCase();
for(int i=0;i<(str.length()-3);i++)
{
char temp[]=str.substring(i,i+4).toCharArray();
Arrays.sort(temp);
String b=new String(temp);
if(b.equals("cefh"))
{
count++;
}
}
if(count==0)
{
System.out.println("normal");
}
else
{
System.out.println("lovely"+" "+count);
}
}
}}