Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <string>
- using namespace std;
- int main()
- {
- int i, n, j, max, k;
- string s;
- getline(cin,s);
- max = 0;
- n = 0;
- j = 0;
- k = s.size();
- for(i = 0; i < k; i++)
- {
- if( s[i] != ' ' )
- {
- n++;
- }
- else
- {
- n = 0;
- }
- if( n > max)
- {
- max = n;
- j = i;
- }
- }
- for( i = j - max; i <= j; i++ )
- {
- cout << s[i];
- }
- cout << endl << max; //<<" " << j;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement