Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool ispal(int n, char s[1000][100])
- {
- bool flag = false;
- for (int i = 0; i < n; i++)
- {
- int d = strlen(s[i]);
- if ((d == 1) || (d == 2))
- flag = false;
- for (int j = 0; j < (d / 2); j++)
- {
- if (s[i][j] != s[i][strlen(s[i]) - j - 1])
- {
- flag = false;
- break;
- }
- flag = true;
- }
- if (flag == true) return true;
- }
- return false;
- }
- bool is_letter(unsigned char c)
- {
- if (c >= (unsigned char)'А' && c <= (unsigned char)'я')
- return true;
- else
- return false;
- }
- int main()
- {
- setlocale(LC_ALL, "Russian");
- FILE* input;
- freopen_s(&input, "input.txt", "r", stdin);
- unsigned char w[100], *pw = nullptr, *words[1000];
- int c = 0, n = 0, i = 0;
- while ((c = getchar()) >= 0)
- {
- if (is_letter(c))
- {
- pw = w;
- i = 0;
- while (is_letter(c))
- {
- *pw++ = c;
- i++;
- c = getchar();
- }
- }
- if (pw)
- {
- pw = nullptr;
- words[n] = new unsigned char[i + 1];
- for (int j = 0; j < i; j++)
- words[n][j] = w[j];
- words[n++][i] = 0;
- }
- }
- for(int j=0; j<n; j++)
- if (ispal(n, words) == true)
- {
- SortVowels(n, words);
- }
- //cout << words[j] << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement