#include <limits>
//...
int main() {
int n;
std::cout << "Enter the length: ";
std::cin >> n;
// Ignore every character up to the newline
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
std::string s;
std::getline(std::cin, s);
std::cout << s;
// Alternate method of pausing the console that doesn't require conio.h
std::cin.sync();
std::cin.get();
return 0;
}