View Code of Problem 3496

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define Max 100
int main()
{
	char s[1000];
	while(gets(s))
	{
		int len=strlen(s);
		for(int i=0;i<len-2;i++)//len-2指那个u最后扫到倒数第三位就行,也避免下面s[i+1]si+2越界 
		{
			if(s[i]=='y' && s[i+1]=='o' && s[i+2]=='u')
			{
				s[i]='w';
				s[i+1]='e';
				s[i+2]='#';
			}
		}
		for(int j=0;j<len;j++)
		{
			if(s[j]!='#')
			printf("%c",s[j]);
		}
		printf("\n");

	}
return 0;
}

Double click to view unformatted code.


Back to problem 3496