2 条题解

  • 0
    @ 2024-11-30 20:37:10
    #include<stdio.h>
    
    #include<string.h>
    
    void tihuan(char *p1,char *p2,int length)
    {
    	int x = 0;
    	for(int i=0;i<length;i++)
    	{
    		if(p1[i]=='y'&&p1[i+1]=='o'&&p1[i+2]=='u')
    		{
    			p2[x++] = 'w';
    			continue;
    		}
    		if(p1[i]=='o'&&p1[i-1]=='y'&&p1[i+1]=='u')
    		{
    			p2[x++] = 'e';
    			continue;
    		}
    		if(p1[i]=='u'&&p1[i-1]=='o'&&p1[i-2]=='y')
    		{
    			continue;
    		}
    		p2[x++] = p1[i];
    	}
    	p2[x] = '\0';
    }
    
    int main()
    {
    	char a1[1000] = {0};
    	char a2[1000] = {0};
    	while(gets(a1))
    	{
    		int len = strlen(a1);
    		tihuan(a1,a2,len);
    		puts(a2);
    		printf("\n");
    	}
    }
    
    • 0
      @ 2023-9-5 9:33:16

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

      • 1

      信息

      ID
      170
      时间
      3000ms
      内存
      128MiB
      难度
      7
      标签
      (无)
      递交数
      941
      已通过
      184
      上传者