CodeForces
来源:互联网 发布:天猫实时大数据 编辑:程序博客网 时间:2024/06/05 18:17
zscoder loves simple strings! A string t is called simple if every pair of adjacent characters are distinct. For example ab, aba, zscoder are simple whereas aa, add are not simple.
zscoder is given a string s. He wants to change a minimum number of characters so that the string s becomes simple. Help him with this task!
Input
The only line contains the string s (1 ≤ |s| ≤ 2·105) — the string given to zscoder. The string s consists of only lowercase English letters.
Output
Print the simple string s’ — the string s after the minimal number of changes. If there are multiple solutions, you may output any of them.
Note that the string s’ should also consist of only lowercase English letters.
Example
Input
aab
Output
bab
Input
caaab
Output
cabab
Input
zscoder
Output
zscoder
#include"stdio.h"int main(){ char ai[300000],chu; int i,j,k,sum; scanf("%s",ai); for (i=0;ai[i]!='\0';i++) { sum=1; j=i; while (ai[i]==ai[i+1]) { sum++; i++; } for (k=j+1;k<=i;k=k+2) { chu='a'; ai[k]=chu; while (ai[k]==ai[k+1]||ai[k]==ai[k-1]) { chu++; ai[k]=chu; } } } printf("%s\n",ai); return 0;}
- codeforces~~~
- Codeforces
- codeforces
- Codeforces
- codeforces
- codeforces
- Codeforces
- Codeforces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- Java SE/EE是啥,ssh等框架是用来干嘛的
- protected-broadcast 规范使用系统应用组件自定义广播
- hud 1428 漫步校园 优先队列+记忆化搜索
- 进程调度时机与进程切换分析
- 利用Anaconda简单安装scrapy框架
- CodeForces
- 并查集的优化措施
- 编译过程的一些知识,针对C/C++
- 获取最小的未被占用的串口号
- 二叉树的遍历初学
- 对集群进行集中管理
- 二叉树的中序遍历
- C++ 让人迷惑的复制构造函数和赋值运算符的区别
- Tarjan求割点——HDU 4587