Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4.  
  5. int main()
  6. {
  7. char tab[1001];
  8. int temp = 0;
  9. int max = 0;
  10.  
  11. scanf("%1000[^n]", tab);
  12.  
  13. for(int i = 0; i < strlen(tab); i++) {
  14. if(isalpha(tab[i])) {
  15. temp++;
  16. }
  17. else if(max < temp) { max = temp; temp = 0; }
  18. else temp = 0;
  19. }
  20.  
  21. temp = 0;
  22.  
  23. printf("%d\n", max);
  24. /*
  25. for(int i = 0; i < strlen(tab); i++) {
  26. if(isalpha(tab[i])) {
  27. temp++;
  28. printf("%d\n", temp);
  29. }
  30. else if(max == temp) {
  31. for(int j = 0; j < max; j++) printf("%c", tab[i - max + i]);
  32. printf("\n");
  33. temp = 0;
  34. }
  35. else temp = 0;
  36. }
  37. */
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement