fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. string file_read_func()
  7. {
  8. string input;
  9. string ret;
  10.  
  11. while (!cin.eof())
  12. {
  13. cin >> input;
  14.  
  15. if (!cin.eof())
  16. {
  17. ret += input;
  18. cin >> input;
  19. ret += input + " ";
  20. }
  21. }
  22.  
  23. return ret;
  24. }
  25.  
  26. int main() {
  27. std::cout << file_read_func();
  28. }
Success #stdin #stdout 0s 2988KB
stdin
foo bar qux
stdout
foobar