Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- template <class Container>
- void split(const std::string& str, Container& cont,
- const std::string& delims = " ")
- {
- std::size_t current, previous = 0;
- current = str.find_first_of(delims);
- while (current != std::string::npos) {
- cont.push_back(str.substr(previous, current - previous));
- previous = current + 1;
- current = str.find_first_of(delims, previous);
- }
- cont.push_back(str.substr(previous, current - previous));
- }
- int main()
- {
- std::string s;
- std::getline(std::cin, s);
- std::vector<std::string> words;
- split(s, words, "10x ");
- int min = stoi(words[0]);
- for (int i = 1; i < words.size(); i++)
- {
- int x;
- x = stoi(words[i]);
- min = x < min ? x : min;
- }
- std::cout << min;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement