codeforces 363C
来源:互联网 发布:ppt转pdf软件 编辑:程序博客网 时间:2024/06/06 03:10
原题链接
C. Fixing Typos
time limit per test1 secondmemory limit per test256 megabytes
inputstandard input
outputstandard output
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.
Input
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.
Output
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.
Examples
input
helloo
output
hello
input
woooooow
output
woow
Note
The second valid answer to the test from the statement is "heloo".
注:一开始写用了标记数组,比较麻烦,而且一直有错误,后来学习了个简单的法子:单个遍历,符合条件就另入一个字符数组
0 0
- codeforces 363C
- CodeForces 363 C. Fixing Typos
- Codeforces 363C. Fixing Typos
- CodeForces 363C - Fixing Typos
- codeforces 363C Fixing Typos
- CodeForces 363C Fixing Typos
- Problem - 363C - Codeforces --C. Fixing Typos
- Codeforces Round #363 (Div. 2) C. Vacations
- Codeforces Round #363 (Div. 2) [C] Vacations
- Codeforces Round #363 (Div. 2) C. Vacations
- Codeforces Round #363 (Div. 2)-C--贪心
- Codeforces Round #363 (Div. 2) C dp
- codeforces#363 C. Vacations dp做法
- Codeforces Round #363 C (Div. 2) Vacations
- Codeforces Round #363 (Div. 1) C LRU
- Codeforces Round #363 (Div. 2), problem: (C)
- Codeforces Round #363 (Div. 2) C. Vacations
- Codeforces Round #363 (Div. 2) C. Vacations
- LeetCode-38. Count and Say
- 52单片机控制指纹模块
- Ubuntu 16.04 LTS 成功编译 Android 6.0 源码教程
- pr_debug、dev_dbg等动态调试三
- .sh文件在/root 下直接执行(软连接)
- codeforces 363C
- 孙鑫网络编程code
- maven项目 main/java missing问题
- js内存泄漏问题
- pkcs5填充
- Redis 学习之事务处理
- 微软仍计划在2017年发布两次Windows 10系统升级
- 变量溢出的计算方法
- python学习4-流程控制-逻辑运算符