Guest User

Говно, а не код

a guest
Apr 7th, 2016
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main() {
  5.  
  6. char str[256];
  7. int i, j, count, length, counter[10], max;
  8.  
  9. gets(str);
  10.  
  11. length = strlen(str);
  12.  
  13. for(i = 0; i < length; i++)
  14. {
  15. for(count = 0, j = i; (str[j] >= 97 && str[j] <= 122) || (str[j] >= 65 && str[j] <= 90); count++, j++);
  16. counter[count - 1]++;
  17.  
  18. for(i = 0; i < 10; i++)
  19. {
  20. printf("%d-", counter[i]);
  21. }
  22. printf("\n");
  23.  
  24. i = j;
  25. }
  26.  
  27. for(i = 1, max = counter[0]; i < 10; i++)
  28. {
  29. if(counter[i] > max)
  30. {
  31. max = counter[i];
  32. }
  33. }
  34.  
  35. for(i = 0; i < 10; i++)
  36. {
  37. if(counter[i] == max)
  38. printf("%d ", i+1);
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment