Advertisement
Josif_tepe

Untitled

Mar 7th, 2024
708
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <map>
  5. #include <algorithm>
  6. using namespace std;
  7. typedef long long ll;
  8.    
  9. int main()
  10. {
  11.     string s = "black red green yellow";
  12.     string tmp = "";
  13.     for(int i = 0; i < s.size(); i++) {
  14.         if(s[i] == ' ') {
  15.             cout << tmp << endl;
  16.             tmp = "";
  17.         }
  18.         else {
  19.             tmp += s[i];
  20.         }
  21.     }
  22.     cout << tmp << endl;
  23.  
  24.     return 0;
  25. }
  26. // 2222222222
  27. // 22222222222
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement