stripping linebreaks and excessive whitespace from solution strings