fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. int main()
  5. {
  6. std::string word;
  7. size_t small = 0, large = 0;
  8.  
  9. std::cin >> word;
  10. if (word != ".") {
  11. small = large = word.size();
  12.  
  13. while (std::cin >> word)
  14. {
  15. if (word == ".") {
  16. break;
  17. }
  18. else
  19. {
  20. if (word.size() > large) {
  21. large = word.size();
  22. }
  23.  
  24. if (word.size() < small) {
  25. small = word.size();
  26. }
  27. }
  28. }
  29.  
  30. }
  31.  
  32. std::cout << "Largest: " << large << "\nSmallest: " << small << "\n";
  33. }
Success #stdin #stdout 0s 15240KB
stdin
Ddddddddddd . sfs
stdout
Largest: 11
Smallest: 11