View Code of Problem 3496

#include <stdio.h>
#include <string.h>
main(){
	int i,j,n;
	char str[1000],*p = str;
	while(gets(p)){
		for(i = 0;;i++){
			if(*(p+i) == 'y'&&*(p+i+1) == 'o'&&*(p+i+2) == 'u'){
				*(p+i) = 'w';
				*(p+i+1) = 'e';
			n = strlen(str);
			for(j =i+2;j<n;j++){
				if(j == n-1){
					*(p+j) = '\0';
					i++;
					}
				*(p+j) = *(p+j+1);
				}
			}
			if(*(p+i) =='\0')
				break;
		}
		puts(p);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 3496