Poj Solution 3981

http://poj.org/problem?id=3981

#include <stdio.h>   
#include <string.h>   
  
#define MAX_LEN 1024   
  
int main(int argc, char **argv)   
{   
    char str[MAX_LEN];   
    int i, len;   
  
    while(gets(str))   
    {   
        len = strlen(str);   
        for(i = 0; i < len; ++i)   
        {   
            if('y' != str[i])   
            {   
                putchar(str[i]);   
            }   
            else  
            {   
                if(i + 2 < len && str[i+1] == 'o' && str[i+2] == 'u')   
                {   
                    putchar('w');   
                    putchar('e');   
                    i += 2;   
                }   
                else  
                {   
                    putchar(str[i]);   
                }   
            }   
        }   
        putchar('n');   
    }   
  
    return 0;   
}  

											
This entry was posted in poj. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *