End-of-Line Trim


When editing text files often times one ends up putting extra spaces and tabs at the end of each line.
Develop a simple algorithm to remove these extra characters.
It shall take an input string and produce a right-trimmed output string.

Examples

Input Output
"abc" "abc"
"abc " "abc"
"abc\t" "abc"
" abc" " abc" (does not remove beginning whitespace)
"ab\r\n cd \r\n" "ab\r\ncd\r\n" (removes whitespace at end of second line)
"\r\n" "\r\n"

Hint

Be sure to handle both Windows \r\n and Unix line endings \n