Rewrited MarkovTextReplacement class for working with console and GUI