reverse input (from getLine) until whitespace using IO