Replacing code block with printUntilTheEndOfString