Created
September 30, 2014 13:57
-
-
Save kartikmaji/a25615e0c4e8b82c88c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<string.h> | |
| int main() | |
| { | |
| char s[10000]; | |
| int a[26]={0}; | |
| int i; | |
| int count=1; | |
| scanf("%s",s); | |
| for(i=0;i<strlen(s);i++) | |
| { | |
| if(s[i]==s[i+1]) | |
| { | |
| count++; | |
| } | |
| if(count>a[s[i]-97]) | |
| { | |
| a[s[i]-97]=count; | |
| } | |
| else | |
| { | |
| count=1; | |
| } | |
| } | |
| int max; | |
| count=0; | |
| max=a[0]; | |
| for(i=0;i<26;i++) | |
| { | |
| if(max<a[i]) | |
| { | |
| count=i; | |
| max=a[i]; | |
| } | |
| } | |
| printf("%c\n",count+97); | |
| printf("%d\n",max); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment