Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <conio.h>
- #include <iostream>
- #include <cmath>
- #include <clocale>
- #include <string>
- #include <fstream>
- using namespace std;
- int main (){
- setlocale(0, "rus");
- int size,l;
- char kon;
- string str,str1;
- bool flag = false;
- ifstream op("g.DAT");
- while(getline(op,str, '\n')){
- int k = 0;
- bool flag;
- for(int i = 0; i < (str.length()+1); i++){
- if(str[i] == ' ' || i == str.length()){
- for(int l = k; l < i; l++){
- cout << str[l] << " ";
- int count = 0;
- for (int d = 0; d < i/2; d++){
- if(str[d]==str[i-1-d]){
- count++;
- }
- }
- if(count == ((i-1)/2)) {
- flag = true;
- }
- else {
- flag = false;
- }
- }
- cout << endl;
- if (flag){
- cout << "Самое большое слово палиндром: ";
- for(int l = k; l < i; l++)
- cout << str[l];
- cout << endl;
- }
- k=i+1;
- flag = false;
- }
- }
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement