-
Notifications
You must be signed in to change notification settings - Fork 0
/
Roy's Life Cycle
45 lines (44 loc) · 958 Bytes
/
Roy's Life Cycle
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
#include <stdio.h>
#include<string.h>
#define max 600000
int main()
{
int n,i,j,code=0,streak=0,maxcode=0;
scanf("%d",&n);
char str[max],str1[max];
for(i=0;i<n;i++){
scanf("%s",str);
strcat(str1,str);
int count=0;
int len=strlen(str);
for(j=0;j<len;j++){
if(str[j]=='C'&& str[j+1]=='C')
count++;
if(str[j]=='C' && str[j+1]=='E')
count=0;
if(str[j]=='C' && str[j+1]=='S')
count=0;
if(count>code)
code=count;
}
if(maxcode<code)
maxcode=code;
}
int count=0;
int len=strlen(str1);
for(j=0;j<len;j++){
if(str1[j]=='C'&& str1[j+1]=='C')
count++;
if(str1[j]=='C' && str1[j+1]=='E')
count=0;
if(str1[j]=='C' && str1[j+1]=='S')
count=0;
if(count>streak)
streak=count;
}
if(maxcode!=0)
printf("%d %d",maxcode+1,streak+1);
else
printf("%d %d",maxcode,streak);
return 0;
}