Advertisement
StoneHaos

Untitled

Jun 29th, 2020
1,228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. #define endl "\n"
  6.  
  7. int main(void) {
  8.     string str, smax, tmax;
  9.     getline(cin, str);
  10.     for (char c : str) {
  11.         if (c != 0x20)
  12.             tmax.push_back(c);
  13.         else {
  14.             if (tmax.size() > smax.size())
  15.                 smax = tmax;
  16.             tmax.clear();
  17.         }
  18.     }
  19.     if (tmax.size() > smax.size())
  20.         smax = tmax;
  21.     cout << smax << endl;
  22.     return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement