Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- #include <string>
- using namespace std;
- int main()
- {
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- system("color 0A");
- cout << "Введите число любой длины" << endl;
- string s;
- getline(cin, s);
- cout << "Числовые полиндромы в этом числе" << endl;
- for (size_t left = 0u; left < s.size() - 1u; ++left)
- {
- for (size_t right = left + 1u; right < s.size(); ++right)
- {
- bool flag = true;
- size_t ind = 0u;
- for (size_t u = left; u <= right; ++u)
- {
- if (s[u] != s[right - ind++])
- {
- flag = false;
- break;
- }
- }
- if (flag)
- {
- for (size_t u = left; u <= right; ++u)
- {
- cout << s[u];
- }
- cout << endl;
- }
- }
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement