不提供代码,我想了解一下,如何在字符串中获取重复的单词,例如:" HelloHelloHelloHello"结果是:"你好"
谢谢
答案 0 :(得分:1)
高层:
对于“HelloHelloHelloHello”示例:
["H","e","l","l","o","H","e","l","l","o", ...]
["He","ll","oH", ...]
["Hell","oHel", ...]
["Hello", "Hello", ...]
答案 1 :(得分:1)
这可能不是实现这一目标的最有效或彻底的方法,但它应该可以工作:
注意:请务必检查字符串的边界,确保在任何这些字符串中都不要尝试检查索引是否超出界限。