CF363C.Fixing Typos
普及/提高-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Many modern text editors automatically check the spelling of the user's text. Some editors even suggest how to correct typos.
In this problem your task to implement a small functionality to correct two types of typos in a word. We will assume that three identical letters together is a typo (for example, word "helllo" contains a typo). Besides, a couple of identical letters immediately followed by another couple of identical letters is a typo too (for example, words "helloo" and "wwaatt" contain typos).
Write a code that deletes the minimum number of letters from a word, correcting described typos in the word. You are allowed to delete letters from both ends and from the middle of the word.
许多现代文本编辑器会自动检查用户输入文本的拼写,有些编辑器甚至会建议如何纠正拼写错误。
在本题中,你的任务是实现一项小型功能,用于纠正单词中的两类拼写错误。我们假设:连续三个相同的字母构成一个拼写错误(例如,单词 helllo 中包含一个拼写错误);此外,一对相同的字母紧跟着另一对相同的字母也构成一个拼写错误(例如,单词 helloo 和 wwaatt 中均包含拼写错误)。
请编写一段代码,从单词中删除最少数量的字母,以修正上述两类拼写错误。你被允许从单词的开头、结尾以及中间任意位置删除字母。
输入格式
The single line of the input contains word s, its length is from 1 to 200000 characters. The given word s consists of lowercase English letters.
输入仅包含一行,即单词 s,其长度为 1 到 200000 个字符。给定的单词 s 仅由小写英文字母组成。
输出格式
Print such word t that it doesn't contain any typos described in the problem statement and is obtained from s by deleting the least number of letters.
If there are multiple solutions, print any of them.
输出满足以下条件的字符串 t:它不包含题目描述中的任何拼写错误,并且是通过对字符串 s 删除最少数量的字母得到的。
如果存在多个解,输出其中任意一个即可。
输入输出样例
输入#1
helloo
输出#1
hello
输入#2
woooooow
输出#2
woow
说明/提示
The second valid answer to the test from the statement is "heloo".
题目陈述中测试的第二个有效答案是 “heloo”。
输入解题思路,AI测评打分。不知道怎么写?