Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- #include <stdio.h>
- #include <cstdio>
- using namespace std;
- int main()
- {
- char str [200];
- printf ("string? ");
- fgets (str, 201, stdin);
- int s, max;
- s=0; max=0;
- for (int i=0; ((i<200) && str[i]!=0); i++)
- if (str[i]!=' ') {s++;}
- else if (max<s) {max=s; s=0;}
- else {s=0;}
- printf ("%d", max);
- getchar ();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement