fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <iterator>
  5.  
  6. using namespace std;
  7.  
  8. vector<string> res(const string& p) {
  9. vector<string> vres;
  10. vres.reserve(p.size());
  11. for(auto c: p) vres.emplace_back(1,c);
  12. return vres;
  13. }
  14.  
  15. int main(int argc, char* argv[])
  16. {
  17. string word = "Hello";
  18.  
  19. vector<string>result = res(word);
  20. copy(result.begin(), result.end(), ostream_iterator<string>(cout, " "));
  21.  
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 4172KB
stdin
Standard input is empty
stdout
H e l l o