-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEpam2.java
50 lines (47 loc) · 871 Bytes
/
Epam2.java
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
import java.util.Scanner;;
public class Epam2 {
public static void main(String[] args) {
System.out.println("Enter how many strings do you have=");
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
String data[]=new String[n];
System.out.println("Enter Actual Strings=");
for(int i=0;i<n;i++)
{
data[i]=sc.next();
}
int days=solve(data);
System.out.println(days);
sc.close();
}
private static int solve(String[] data) {
String str;
int count=0;
int maxcount=0;
for(int i=0;i<data.length;i++)
{
str=data[i];
int j;
for(j=0;j<str.length();j++)
{
if(str.charAt(j)=='N')
{
break;
}
}
if(j==str.length())
{
count=count+1;
}
else
{
count=0;
}
if(maxcount<count)
{
maxcount=count;
}
}
return maxcount;
}
}