Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- string s,smax;
- char c;
- s = "";
- bool flag = true;
- while(c != '.'){
- cin >> c;
- if (c != ' ' && c != '.'){
- s += c;
- }
- if (c == ' ' || c == '.'){
- for (int i = 0; i < s.size() / 2 + 1; ++i){
- if (s[i] != s[s.size() - i){
- flag = false;
- }
- }
- if (flag){
- if (s.size() >= smax.size()){
- smax = s;
- }
- }
- s = "";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement