Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2.  
  3. #include <stdio.h>
  4. #include <windows.h>
  5. #include <string.h>
  6.  
  7. void ab(char *s)
  8. {
  9. char *word, str[50], ser[50];
  10. int a = 1;
  11. strcpy(str, s);
  12. word = strtok(str, " ");
  13. do {
  14. strcpy(ser, str);
  15. _strrev(ser);
  16. a = strcmp(ser, str);
  17. if (a == 0) break;
  18. word = strtok(NULL, " ");
  19. } while (word);
  20. }
  21. void kil(char *s)
  22. {
  23.  
  24. char *word, str[50], *ser[50], *easy[50], *maxi = NULL;
  25. int a = 0, max = 0, mas[50];
  26. strcpy(str, s);
  27. word = strtok(str, " ");
  28. do {
  29. ser[a] = word;
  30. a++;
  31. word = strtok(NULL, " ");
  32. } while (word);
  33. for (int i = 0; i < a; i++) {
  34. int g = 0;
  35. for (int j = 0; j < a; j++) {
  36. if (strcmp(ser[i], ser[j]) == 0) g++;
  37. }
  38. if (g > max) {
  39. max = g;
  40. maxi = ser[i];
  41. }
  42.  
  43.  
  44.  
  45. }
  46.  
  47. for (int i = 0; i < a; i++) mas[i] = 1;
  48.  
  49. for (int i = 0; i < a; i++) {
  50. int g = 0;
  51. for (int j = 0; j < a; j++) {
  52. if (strcmp(ser[i], ser[j]) == 0) {
  53. g++;
  54. if (g > 1) mas[j] = 0;
  55. }
  56. }
  57. }
  58. int z = 0;
  59. for (int i = 0; i < a; i++) {
  60. if (mas[i] == 1) {
  61. easy[z] = ser[i];
  62. z++;
  63. }
  64. }
  65. printf("Slova bez povtoriv:");
  66. for (int i = 0; i < z; i++) {
  67. printf("%s ", easy[i]);
  68. }
  69. printf("\n");
  70. printf(" kilkist - %i ",z);
  71.  
  72. char abc[27] = { "qwertyuiopasdfghjklzxcvbnm" };
  73.  
  74. for (int i = 0; i < 26; i++) {
  75. int g = 0;
  76. for (int j = 0; j < z; j++) {
  77. if (abc[i] == easy[j][0])g++;
  78. }
  79. if (g >= 1)printf("Na bukvu (%c) sliv (%i)\n", abc[i], g);
  80. }
  81. }
  82.  
  83.  
  84. int main()
  85. {
  86. char s[50];
  87. gets_s(s);
  88. kil(s);
  89. puts(s);
  90. system("pause");
  91. return 0;
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement