read-and-write.cpp

#include <string>

string input;

// read input
cin >> input;
// input = 1 2 3 4

// print input
cout << input << endl;
// 1

// or getline to get line
getline(cin, input);
cout << input << endl;
// 1 2 3 4