Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma hdrstop
- #pragma argsused
- #ifdef _WIN32
- #include <tchar.h>
- #else
- typedef char _TCHAR;
- #define _tmain main
- #endif
- #include <stdio.h>
- #include <iostream>
- #include <windows.h>
- #include <conio.h>
- using namespace std;
- //Too swift for Theex, too quick for Gallow
- void Answer(char* b, int count)
- {
- for (int t=0; t < count; t++)
- cout << b[t] ;
- }
- void Letters(char* str)
- {
- int count=0;
- char b[1000];
- for (int i = 0; str[i]; i++)
- {
- if ((str[i]=='c')&&((str[i+1]=='e')||(str[i+1]=='i')||(str[i+1]=='y')))
- {
- if((count != 0 && b[count-1] != 's' && b[count-1] != 'S') || count == 0)
- {
- b[count] = 's';
- count++;
- }
- }
- else if ((str[i]=='C')&&((str[i+1]=='e')||(str[i+1]=='i')||(str[i+1]=='y')))
- {
- if((count != 0 && b[count-1] != 'S' && b[count-1] != 's') || count == 0)
- {
- b[count] = 'S';
- count++;
- }
- }
- else if (str[i]=='c')
- {
- if((count != 0 && b[count-1] != 'k' && b[count-1] != 'K') || count == 0)
- {
- b[count] = 'k';
- count++;
- }
- }
- else if (str[i]=='C')
- {
- if((count != 0 && b[count-1] != 'K' && b[count-1] != 'k') || count == 0)
- {
- b[count] = 'K';
- count++;
- }
- }
- else if ((str[i]=='q')&&(str[i+1]=='u'))
- {
- if((count != 0 && b[count-1] != 'k' && b[count-1] != 'K') || count == 0)
- {
- b[count] = 'k';
- b[count + 1] = 'v';
- count += 2;
- }
- }
- else if ((str[i]=='Q')&&(str[i+1]=='u'))
- {
- if((count != 0 && b[count-1] != 'K' && b[count-1] != 'k') || count == 0)
- {
- b[count] = 'K';
- b[count + 1] = 'v';
- count += 2;
- }
- }
- else if (str[i]=='q')
- {
- if((count != 0 && b[count-1] != 'k' && b[count-1] != 'K') || count == 0)
- {
- b[count] = 'k';
- count++;
- }
- }
- else if (str[i]=='Q')
- {
- if((count != 0 && b[count-1] != 'K' && b[count-1] != 'k') || count == 0)
- {
- b[count] = 'K';
- count++;
- }
- }
- else if (str[i]=='x')
- {
- if((count != 0 && b[count-1] != 'k' && b[count-1] != 'K') || count == 0)
- {
- b[count] = 'k';
- b[count + 1] = 's';
- count += 2;
- }
- else if(count != 0 && b[count-1] == 'k' && b[count-1] != 'K')
- {
- b[count] = 's';
- count++;
- }
- }
- else if (str[i]=='X')
- {
- if((count != 0 && b[count-1] != 'K' && b[count-1] != 'k') || count == 0)
- {
- b[count] = 'K';
- b[count + 1] = 's';
- count += 2;
- }
- else if(count != 0 && b[count-1] == 'K' && b[count-1] != 'k')
- {
- b[count] = 's';
- count++;
- }
- }
- else if (str[i]=='w')
- {
- if((count != 0 && b[count-1] != 'v' && b[count-1] != 'V') || count == 0)
- {
- b[count] = 'v';
- count++;
- }
- }
- else if (str[i]=='W')
- {
- if((count != 0 && b[count-1] != 'V' && b[count-1] != 'v') || count == 0)
- {
- b[count] = 'V';
- count++;
- }
- }
- else if ((str[i]=='p')&&(str[i+1]=='h'))
- {
- if((count != 0 && b[count-1] != 'f' && b[count-1] != 'F') || count == 0)
- {
- b[count] = 'f';
- count++;
- }
- i++;
- }
- else if ((str[i]=='P')&&(str[i+1]=='h'))
- {
- if((count != 0 && b[count-1] != 'F' && b[count-1] != 'f') || count == 0)
- {
- b[count] = 'F';
- count++;
- }
- i++;
- }
- else if ((str[i]=='y')&&(str[i+1]=='o')&&(str[i+2]=='u'))
- {
- if((count != 0 && b[count-1] != 'u' && b[count-1] != 'U') || count == 0)
- {
- b[count] = 'u';
- count++;
- }
- i += 2;
- }
- else if ((str[i]=='o')&&(str[i+1]=='o'))
- {
- if((count != 0 && b[count-1] != 'u' && b[count-1] != 'U') || count == 0)
- {
- b[count] = 'u';
- count++;
- }
- i++;
- }
- else if ((str[i]=='Y')&&(str[i+1]=='o')&&(str[i+2]=='u'))
- {
- if((count != 0 && b[count-1] != 'U' && b[count-1] != 'u') || count == 0)
- {
- b[count] = 'U';
- count++;
- }
- i += 2;
- }
- else if ((str[i]=='O')&&(str[i+1]=='o'))
- {
- if((count != 0 && b[count-1] != 'U' && b[count-1] != 'u') || count == 0)
- {
- b[count] = 'U';
- count++;
- }
- i++;
- }
- else if ((str[i]=='e')&&(str[i+1]=='e'))
- {
- if((count != 0 && b[count-1] != 'i' && b[count-1] != 'I') || count == 0)
- {
- b[count] = 'i';
- count++;
- }
- i++;
- }
- else if ((str[i]=='E')&&(str[i+1]=='e'))
- {
- if((count != 0 && b[count-1] != 'I' && b[count-1] != 'i') || count == 0)
- {
- b[count] = 'I';
- count++;
- }
- i++;
- }
- else if ((str[i]=='t')&&(str[i+1]=='h'))
- {
- if((count != 0 && b[count-1] != 'z' && b[count-1] != 'Z') || count == 0)
- {
- b[count] = 'z';
- count++;
- }
- i++;
- }
- else if ((str[i]=='T')&&(str[i+1]=='h'))
- {
- if((count != 0 && b[count-1] != 'Z' && b[count-1] != 'z') || count == 0)
- {
- b[count] = 'Z';
- count++;
- }
- i++;
- }
- else if (str[i]==str[i+1])
- {
- if((count != 0 && b[count-1] != str[i]) || count == 0)
- {
- b[count] = str[i];
- count++;
- }
- i++;
- }
- // else if ((str[i]=='C')||(str[i]=='Q')||(str[i]=='W')||(str[i]=='X'))
- // {
- // b[i]=str[i];
- // count++;
- // }
- else
- {
- if((count != 0 && tolower(b[count-1]) != tolower(str[i])) || count == 0)
- {
- b[count] = str[i];
- count++;
- }
- }
- }
- Answer(b, count);
- }
- int _tmain(int argc, _TCHAR* argv[])
- {
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- char str[81];
- cout << " Введите строку : ";
- gets(str);
- Letters(str);
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement