Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// Se da un sir de n cuvinte sa se determine cel mai lung cuvant
- #include<iostream>
- #include<cstring>
- using namespace std;
- char x[256];
- int main()
- {
- cin.getline(x, 256);
- int lungime_max = 0, lungime = 0;
- char *p = strtok(x, " ");
- while(p != NULL)
- {
- lungime = strlen(p);
- if(lungime > lungime_max)
- lungime_max = lungime;
- p = strtok(NULL, " ");
- }
- cout << lungime_max;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement