will help you I'm not sure I completely follow you, but if you're looking to define a variable over several lines, you could define the string using a verbatim string literal, and then split on Environment.NewLine (\r\n)
With these it helps Your major problem is that you are replacing letter-whitespace-letter with more white space, deleting the letters on either side of it. So your line never gets longer, and your loop never terminates. Put the letters in their own groups, and add references (e.g., \1) to the replacement string.
Scala Iterable[(String, Long)] to SortedMap[String,Long] or TreeMap[String, Long] sorted in decreasing order of value