Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- #include <windows.h>
- #include <string.h>
- void ab(char *s)
- {
- char *word, str[50], ser[50];
- int a = 1;
- strcpy(str, s);
- word = strtok(str, " ");
- do {
- strcpy(ser, str);
- _strrev(ser);
- a = strcmp(ser, str);
- if (a == 0) break;
- word = strtok(NULL, " ");
- } while (word);
- }
- void kil(char *s)
- {
- char *word, str[50], *ser[50], *easy[50], *maxi = NULL;
- int a = 0, max = 0, mas[50];
- strcpy(str, s);
- word = strtok(str, " ");
- do {
- ser[a] = word;
- a++;
- word = strtok(NULL, " ");
- } while (word);
- for (int i = 0; i < a; i++) {
- int g = 0;
- for (int j = 0; j < a; j++) {
- if (strcmp(ser[i], ser[j]) == 0) g++;
- }
- if (g > max) {
- max = g;
- maxi = ser[i];
- }
- }
- for (int i = 0; i < a; i++) mas[i] = 1;
- for (int i = 0; i < a; i++) {
- int g = 0;
- for (int j = 0; j < a; j++) {
- if (strcmp(ser[i], ser[j]) == 0) {
- g++;
- if (g > 1) mas[j] = 0;
- }
- }
- }
- int z = 0;
- for (int i = 0; i < a; i++) {
- if (mas[i] == 1) {
- easy[z] = ser[i];
- z++;
- }
- }
- printf("Slova bez povtoriv:");
- for (int i = 0; i < z; i++) {
- printf("%s ", easy[i]);
- }
- printf("\n");
- printf(" kilkist - %i ",z);
- char abc[27] = { "qwertyuiopasdfghjklzxcvbnm" };
- for (int i = 0; i < 26; i++) {
- int g = 0;
- for (int j = 0; j < z; j++) {
- if (abc[i] == easy[j][0])g++;
- }
- if (g >= 1)printf("Na bukvu (%c) sliv (%i)\n", abc[i], g);
- }
- }
- int main()
- {
- char s[50];
- gets_s(s);
- kil(s);
- puts(s);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement