Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- string s;
- getline(cin, s);
- s += " ";
- int pos = 0;
- int ma = -1000000;
- int sPos = 0;
- while (s.find(" ", pos) !=-1) {
- if (ma < s.find(" ", pos) - pos) {
- ma = s.find(" ", pos) - pos;
- sPos = pos;
- }
- cout << s.find(" ", pos)-pos << endl;
- pos = s.find(" ", pos) +1;
- }
- cout << ma;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement