口吃是我们中许多人可能经历过或至少已经看到的问题。虽然大多数著名的语音识别软件都有严重的口吃问题,但让我们想象一下,有一个软件能够理解口吃,但不能修复,只能按原样编写。
这样一个软件编写的例子可以是这样的:“请小心”。在这个例子中,“小心”是原始单词," ca“是结巴词。
编写一个程序或函数,通过从输入中删除口吃单词来修复口吃单词,同时保留原始单词。例如,固定版本的“请小心”将是“请小心”。
这是密码-高尔夫,最短的答案在每种语言中获胜!
口吃有许多不同的变化。但为了简化这一挑战,我们将把它限制在以下规则上:
["l","i","s","t"," ","o","f"," ","l","e","t","t","e","r","s"])代替字符串,但不能使用单词列表。如果您的语言有不同的输入结构,请使用它。关键是输入不应该被单词分开,所以在某些语言中分离单词的成本实际上可能会触发其他创造性的解决方案。标准漏洞是禁止的。
不要结结巴巴的说:
"hello world" => "hello world"重复口吃的一个例子:
"ope ope ope ope open the window" => "open the window"多次重复口吃的例子:
"there is is is is something un un under the the the table" => "there is something under the table"没有结巴的话,也没有足够的重复:
"give me the the book" => "give me the the book"没有结巴的词,没有提到的元音:
"h h help m m m me" => "h h help m m m me"数字不是结巴词,它们没有提到的元音:
"my nu nu number is 9 9 9 9876" => "my number is 9 9 9 9876"但是一个兼有元音和数字的单词可能会结结巴巴的:
"my wi wi windows10 is slow" => "my windows10 is slow"同一重复组中不同形式的口吃词不算在内:
"this is an ant antarctica does not have" => "this is an ant antarctica does not have"对于多个连续的结巴词集,只保留最后一个原始单词:
"what a be be be beauti beauti beautiful flower" => "what a beautiful flower"这不是一个多个连续的口吃词集的情况,就在彼此之后:
"drink wat wat wa wa water" => "drink wat wat water"空输入:
"" => ""评论中的更多案例:
"a ab abc" => "a ab abc"
"a ab ab abc" => "a abc"
"ab ab abc abcd" => "abc abcd"
"a a ab a able" => "ab a able"
"i have ave ave average" => "i have average"
"my wi wi windows 10 is cra cra crap" => "my windows 10 is crap""hello world",
"ope ope ope ope open the window",
"there is is is is something un un under the the the table",
"give me the the book",
"h h help m m m me",
"my nu nu number is 9 9 9 9876",
"my wi wi windows10 is slow",
"this is an ant antarctica does not have",
"what a be be be beauti beauti beautiful flower",
"drink wat wat wa wa water",
"",
"a ab abc",
"a ab ab abc",
"ab ab abc abcd",
"a a ab a able",
"i have ave ave average",
"my wi wi windows 10 is cra cra crap"https://codegolf.stackexchange.com/questions/193196
复制相似问题