Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4.  
  5. template <class Container>
  6. void split(const std::string& str, Container& cont,
  7. const std::string& delims = " ")
  8. {
  9. std::size_t current, previous = 0;
  10. current = str.find_first_of(delims);
  11. while (current != std::string::npos) {
  12. cont.push_back(str.substr(previous, current - previous));
  13. previous = current + 1;
  14. current = str.find_first_of(delims, previous);
  15. }
  16. cont.push_back(str.substr(previous, current - previous));
  17. }
  18.  
  19. int main()
  20. {
  21. std::string s;
  22. std::getline(std::cin, s);
  23. std::vector<std::string> words;
  24. split(s, words, "10x ");
  25. int min = stoi(words[0]);
  26. for (int i = 1; i < words.size(); i++)
  27. {
  28. int x;
  29. x = stoi(words[i]);
  30. min = x < min ? x : min;
  31. }
  32. std::cout << min;
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement