Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int checkWord(const char * w)
- {
- int cnt[256] = { 0 };
- while(*w) cnt[(unsigned char)(*w++)]++;
- for(int i = 0; i < 256; ++i)
- if (cnt[i] == 1) return 0;
- return 1;
- }
- int main(int argc, const char * argv[])
- {
- char s[256];
- char * words[50];
- int idx = 0;
- puts("Введите последовательность символов");
- fgets( s, sizeof( s ) - 1, stdin ) )
- for(char * w = strtok(s," ."); w; w = strtok(NULL," ."))
- {
- if (checkWord(w)) words[idx++] = w;
- }
- —idx;
- for(int i = 0; i < idx-1; ++i)
- {
- if (strcmp(words[i],words[idx])) printf("%s\n",words[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement