Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- char s[101], t[101], *p;
- bool gasit = false;
- cin.getline(s, 101);
- p = strtok(s , " ");
- while(p != NULL)
- {
- bool ok = true;
- for(int i = 0 ; p[i] != '\0' ; i ++)
- if(strchr("0123456789", p[i]) == NULL)
- ok = false;
- if(ok)
- {
- if(!gasit)
- strcpy(t,p), gasit = true;
- else
- if(p[0] > t[0])
- strcpy(t,p);
- }
- p = strtok(NULL, " ");
- }
- if(gasit)
- cout << t;
- else
- cout << "nu exista";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement