A little refactor, separated memory section
Read a whole string from stdin (no separate \n)