Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <locale.h>
- #include <string.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- int main()
- {
- system("chcp 1251 > nul");
- SetConsoleTitle("ОтветыМейлРу"); // Русские буквы
- char delim[3] = ", ";
- char str[100];
- fgets(str, 100, stdin);
- fflush(stdin);
- printf("%s\n", str);
- char str2[100]=""; char str3[100];
- int lw, ls, chk, temp, i, j, lw2=0;
- strcpy(str3, str);
- printf("%s\n", str2);
- char *p = strtok(str, delim);
- do
- {
- lw2 += strlen(p)+1;
- for(int i = 0; i < lw2; i++) str3[i] = '\0';
- if(strstr(str3, p) == NULL)
- {
- strcat(str2, p);
- strcat(str2, " ");
- printf("%s\n", str2);
- }
- else
- {
- ls = strlen(str3);
- lw = strlen(p);
- for(i = 0; i < ls; i++)
- {
- temp = i;
- for(j = 0; j < lw; j++)
- {
- if(str3[i] == p[j]) i++;
- }
- chk = i-temp;
- if(chk == lw)
- {
- i = temp;
- for(j = i; j < (ls - lw); j++) str3[j] = str3[j + lw];
- ls = ls - lw;
- str3[j] = '\0';
- }
- }
- }
- strcpy(str, str3);
- }while(p = strtok(NULL, delim));
- printf("%s\n", str2);
- printf("\n"); system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement