View Code of Problem 3496

#include<stdio.h>
#include<string.h>
int main()
{
    char s[1003];
    while (gets(s) != NULL)
    {
        int len = strlen(s);
        for (int i = 0; i < len; i++)
        {
            if (s[i] == 'y' && s[i + 1] == 'o' && s[i + 2] == 'u')
            {
                printf("we");
                i += 3;//加2就可以了,因为不进行else的语句执行了,马上进入循环,i还会+1
            }
			if(i < len) 
            	printf("%c", s[i]);
        }
        	printf("\n");
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 3496