Advertisement
CLazStudio

q198997730

Mar 14th, 2017
563
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     string s;
  9.     getline(cin, s);
  10.  
  11.     string temp = "";
  12.     for (int i = 0; i <= s.size(); i++)
  13.     {
  14.         if ((s[i] == ' ') || (i == s.size())) {
  15.             if (temp.size() == 0) continue;
  16.             if (temp[0] == temp[temp.size() - 1])
  17.                 cout << temp << endl;
  18.             temp = "";
  19.         } else {
  20.             temp += s[i];
  21.         }
  22.     }
  23.  
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement