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;
- string word;
- getline(cin, query);
- for (int i = 0; i < query.size(); ++i) {
- if (query[i] == ' ') {
- cout << '[' << word << ']' << endl;
- word = ""s;
- } else {
- word = word + query[i];
- }
- }
- cout << '[' << word << ']' << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement