POJ3981 字符串替换
来源:互联网 发布:黑魂三捏脸数据男 编辑:程序博客网 时间:2024/06/06 01:47
字符串替换
Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9285 Accepted: 4438
Description
编写一个C程序实现将字符串中的所有"you"替换成"we"
Input
输入包含多行数据
每行数据是一个字符串,长度不超过1000
数据以EOF结束
每行数据是一个字符串,长度不超过1000
数据以EOF结束
Output
对于输入的每一行,输出替换后的字符串
Sample Input
you are what you do
Sample Output
we are what we do
#include <iostream>#include <stdio.h>#include <string.h>#include <stdlib.h>#include <math.h>#include <algorithm>using namespace std;int main(){ char str1[1001],str2[1001]; int i; while(gets(str1)!=NULL) { int len=strlen(str1); for(i=0;i<len;i++) { if(str1[i]=='y'&&str1[i+1]=='o'&&str1[i+2]=='u') { str1[i]='w'; str1[i+1]='e'; str1[i+2]=1; } } for(i=0;i<len;i++) { if(str1[i]!=1) printf("%c",str1[i]); } printf("\n"); }}
0 0
- POJ3981字符串替换
- POJ3981 字符串替换
- poj3981(字符替换)
- poj3981字符串替换 水的以至于浪费时间的水题
- poj3981
- 字符串替换
- 字符串替换
- 替换字符串
- 字符串替换
- 替换字符串
- 字符串替换
- 字符串替换
- 字符串替换
- 替换字符串
- 字符串替换
- 字符串替换
- 字符串替换
- 字符串替换
- huhuliuxia
- ios开发新手如何看待JSON格式数据(适合OC刚刚入门的童鞋)
- PCL: Registration模块之IterativeClosestPoint点云配准
- HDU-1285--确定比赛名次 (拓扑排序)
- 下资源网站”逆向工程,软件破解学习资料汇总
- POJ3981 字符串替换
- Fastmodels安装
- 杭电2051(二进制转换)----20140730
- seL4微内核开源
- 自作孽。。。
- Android离线语音识别demo调试(Ubuntu12.04)
- HDU 1160 FatMouse's Speed (动规+最长递减子序列)
- hdu4865Peter's Hobby马尔科夫过程
- 很久没有好好的看书学习了