我必须使用某些规则编辑文本:
同一单词中的重复字母将减少为单个字母。
"Questions" instead of "QuestionssSsS"
单词之间的多个空格将减少到一个空格
"go to the cinema" instead of "go to the cinema"
与单词分离的单个字母将连接到单词
"first ten person" instead of "firs t ten person"
例如 :
String s = "I am enouuugGh of an artis t to draw freely upon my imagination. ImaginatioOO n is more importan t than knowledge. KKkKkKnowledge is limited. Imagination encircles the wwWorl d.";
预期输出:
I am enough of an artist to draw freely upon my imagination. Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world.
请提出建议和意见。