Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int foo(char asd[100]){
  6. int i=1, j, max=1;
  7. for(j=1;j<=strlen(asd);j++){
  8.  
  9. if(asd[j]==asd[j-1]){
  10. i++;
  11. if(i>max)
  12. max=i;
  13. }
  14.  
  15. else
  16. i=1;
  17. }
  18. return max;
  19. }
  20.  
  21. int main()
  22. {
  23. char line[100];
  24. while (gets(line) != NULL)
  25. printf("%d\n", foo(line));
  26. return EXIT_SUCCESS;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement