Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- string query;
- getline(cin, query);
- string word = ""s;
- char space = ' ';
- for (int i = 0; i < query.size(); ++i) {
- if (query[i] != space) {
- word += query[i];
- }
- else {
- std::cout << "[" << word << "]" << endl;
- word = ""s;
- }
- }
- std::cout << "[" << word << "]";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement