poj 3981 字符串替换
2016-08-22 21:01
211 查看
字符串替换
Description
编写一个C程序实现将字符串中的所有"you"替换成"we"
Input
输入包含多行数据
每行数据是一个字符串,长度不超过1000
数据以EOF结束
Output
对于输入的每一行,输出替换后的字符串
SampleInput
SampleOutput
TimeLimit:1000MS | MemoryLimit:65536K | |
TotalSubmissions:10871 | Accepted:5100 |
编写一个C程序实现将字符串中的所有"you"替换成"we"
Input
输入包含多行数据
每行数据是一个字符串,长度不超过1000
数据以EOF结束
Output
对于输入的每一行,输出替换后的字符串
SampleInput
youarewhatyoudo
SampleOutput
wearewhatwedo
#include<stdio.h> #include<string.h> charstr[1003]; intmain(){ inti; while(gets(str)){ for(i=0;str[i]!='\0';i++){ if(str[i]=='y'&&str[i+1]=='o'&&str[i+2]=='u'){ printf("we"); i+=2; }else{ printf("%c",str[i]); } } printf("\0"); printf("\n"); } return0; }
相关文章推荐
- POJ3981字符串替换
- poj 3981 字符串替换
- POJ-3981-字符串替换
- poj 3981 字符串替换
- 【ACM】poj_3981_字符串替换_201307271019
- poj 3981 字符串替换
- POJ 3981(字符串替换)
- POJ 3981 字符串替换 G++
- POJ 3981 字符串替换(水~)
- POJ 3981 字符串替换
- POJ,北大OJ3981,字符串替换题目。。简单的输出。
- POJ--3981:字符串替换
- POJ 3981 字符串替换
- HDUOJ3981字符串替换
- POJ 1572 Automatic Editing 字符串替换,replace就够了
- hdu-3981-字符串替换
- pku--3981 给定字符串替换
- POJ 1917 字符串替换
- POJ 1572 字符串替换
- HDUOJ3981字符串替换