string parsing and reprinting