Advertisement
rotti321

cuvinte9 of

Jan 16th, 2022
37
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cstring>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. char s[101], t[101], *p;
  9. bool gasit = false;
  10. cin.getline(s, 101);
  11. p = strtok(s , " ");
  12. while(p != NULL)
  13. {
  14. bool ok = true;
  15. for(int i = 0 ; p[i] != '\0' ; i ++)
  16. if(strchr("0123456789", p[i]) == NULL)
  17. ok = false;
  18. if(ok)
  19. {
  20. if(!gasit)
  21. strcpy(t,p), gasit = true;
  22. else
  23. if(p[0] > t[0])
  24. strcpy(t,p);
  25. }
  26.  
  27. p = strtok(NULL, " ");
  28. }
  29. if(gasit)
  30. cout << t;
  31. else
  32. cout << "nu exista";
  33. return 0;
  34. }
Advertisement
RAW Paste Data Copied
Advertisement