1 #include <stdio.h>
2
3 char a[] = "aaaaaaaaabbbbbbbddddddddddddcccccrrrrrrrrrrrrrrrrrrrrrrr";
4
5 int tempCount = 0;
6 int resultCount = 0;
7 char resultChar = '/0';
8
9 main()
10 {
11 int i = 0;
12 while(a != NULL && a[i]!= '/0')
13 {
14 if(resultCount == 0)
15 {
16 resultCount = 1;
17 resultChar = a[i];
18 }
19 if(a[i] == a[i+1])
20 {
21 if(resultCount < (++tempCount+1))
22 {
23 resultCount = tempCount+1;
24 resultChar = a[i];
25 }
26 }
27 else
28 {
29 tempCount = 0;
30 }
31 i++;
32 }
33 printf("%d %c/n",resultCount,resultChar);
34 }