Added dynamic input allocation and cleaned up some trailing whitespace.

Simple change to allow input of an unknown line length. The input will start at 1024 characters, if the buffer is not large enough it will expand by 2x. Example: 1024->2048->4096->etc..