fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <cassert>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. string construct;
  9. while(true) {
  10. string current;
  11. getline(cin, current);
  12. assert(!cin.eof());
  13. if (current.find("end") == 0) { break; }
  14. cout << current << endl;
  15. construct.append(current);
  16. }
  17. cout << construct << endl;
  18. return 0;
  19. }
Success #stdin #stdout 0s 3280KB
stdin
First line.
Second line.
Third line.
end
stdout
First line.
Second line.
Third line.
First line.Second line.Third line.