Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- const string alpha = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
- //const string alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- vector<string> parse (string str)
- {
- int pos;
- vector<string> vec;
- while ((pos = str.find(',')) != string::npos)
- {
- vec.push_back(str.substr(0, pos));
- str = str.substr(pos + 1);
- }
- vec.push_back(str);
- return vec;
- }
- void choose_words(vector<string> vec, int n)
- {
- vector<string> ans;
- for (int i = 0; i < vec.size(); ++i)
- {
- if(vec[i].length() >= n)
- ans.push_back(vec[i]);
- }
- for (int i = 0; i < ans.size() - 1; ++i)
- cout << ans[i] << ',';
- cout << ans[ans.size() - 1];
- }
- int main()
- {
- string str;
- getline(cin, str);
- int n;
- cin >> n;
- vector<string> arr_of_words = parse(str);
- /*for (int i = 0; i < arr_of_words.size(); ++i)
- cout << arr_of_words[i] << endl;*/
- choose_words(arr_of_words, n);
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement