-
Notifications
You must be signed in to change notification settings - Fork 0
/
Q3_1069.java
34 lines (32 loc) · 835 Bytes
/
Q3_1069.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
/* NAME: SHAHID ABDUL FARHAD
* REGD. NO.: 2341006002
* PS LINK: https://cses.fi/problemset/task/1069
*/
package CodexStart_2341006002;
import java.util.*;
public class Q3_1069
{
public static void main(String[] args)
{
Scanner in= new Scanner(System.in);
String s= in.next();
int i,l,c=1,max=1;
char ch;
l=s.length();
for(i=1;i<l;i++)
{
ch=s.charAt(i);
if(ch==s.charAt(i-1))
{
c++;
}
else
{
max=(int)(Math.max(max,c));
c=1;
}
}
max=(int)(Math.max(max,c));
System.out.println(max);
}
}