Advertisement
Guest User

Untitled

a guest
May 27th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.28 KB | None | 0 0
  1. int f(char *s)
  2. {
  3.   int m = 0, c = 0;
  4.   while (*s) {
  5.     c++;
  6.     if (*s != *(s + 1)) {
  7.       if (c > m)
  8.         m = c;
  9.       c = 0;
  10.     }
  11.     s++;
  12.   }
  13.   return m;
  14. }
  15.  
  16. int main()
  17. {
  18.   char *s = "aaaaaaaaabbbbbbbbbbbbbaaaagggdfaaaaaaaaaaarwetrwe";
  19.   int r = f(s);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement