1 solutions
-
0
#include <bits/stdc++.h> using namespace std; int main() { string s, str; int max1= 0,i; getline(cin, s); int start = 0; for (i = 0; i < s.length(); i++) { if (s[i] ' '||s[i]'.') { int len = i - start; if (len > max1) { max1 = len; str = s.substr(start, len); } start = i + 1; } } int len2 = s.length() - start; if (len2 > max1) { str = s.substr(start, len2); } cout << str << endl; return 0; }
Information
- ID
- 6792
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 7
- Tags
- (None)
- # Submissions
- 88
- Accepted
- 19
- Uploaded By