fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. string words;
  10. getline(cin, words);
  11.  
  12. stringstream ss(words);
  13. string shWrd = words;
  14.  
  15. for (string s; ss >> s;)
  16. {
  17. if (s.size() < shWrd.size())
  18. shWrd = s;
  19. }
  20.  
  21. cout << "Short: " << shWrd << endl;
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0s 3476KB
stdin
wwe hgh gf  d ds  sd ds www
stdout
Short: d