Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <vector>
- #include <string>
- using namespace std;
- vector<string> SplitIntoWords(const string& s) {
- vector<string> result;
- std::istringstream iss(s);
- string pice;
- while (std::getline(iss, pice, ' ')) {
- result.push_back(pice);
- }
- return result;
- }
- int main() {
- string s = "C Cpp Java Python";
- vector<string> words = SplitIntoWords(s);
- cout << words.size() << " ";
- for (auto it = begin(words); it != end(words); ++it) {
- if (it != begin(words)) {
- cout << "/";
- }
- cout << *it;
- }
- cout << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement