Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <cstring>
- #include <cstdio>
- #include <cstddef>
- using namespace std;
- int main()
- {
- string s1 = "", s = "", a;
- int l, n = 0, m = 0;
- getline(cin, a);
- l = a.length();
- for (int i = 0; i < l; i++)
- {
- if ((int)a[i] != 32)
- {
- s1 += a[i];
- n += 1;
- }
- else
- {
- if (n > m)
- {
- s = s1;
- m = n;
- }
- n = 0;
- s1 = "";
- }
- }
- if (n > m)
- {
- s = s1;
- m = n;
- }
- cout << s << "\n" << m;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement