rev to reverse input line by line