4 条题解

  • 0
    @ 2025-10-16 2:26:24
    #include<iostream>
    #include<cstring>
    using namespace std;
    int main(){
        char a[1005];
        while(cin.getline(a,1005)){
            int len=strlen(a);
            for(int i=0;i<len;i++){
                if(a[i]=='y'&&a[i+1]=='o'&&a[i+2]=='u'){cout<<"we";i=i+2;continue;}
                cout<<a[i];
            }
            cout<<'\n';    //别忘了换行
        }
        return 0;
    }
    
    • 0
      @ 2025-10-5 14:48:04
      #include<stdio.h>
      #include<string.h>
      int main()
      {
          char a[1010];
          int l;
          while(fgets(a,sizeof(a),stdin)!=NULL){//整行输入
              l=strlen(a);
              for(int i=0;i<l-2;i++){
                  if(a[i]=='y'&&a[i+1]=='o'&&a[i+2]=='u'){
                      a[i]='w';
                      a[i+1]='e';
                      for(int j=i+2;j<l;j++){
                      a[j]=a[j+1];
                      }
                      l--;
                      i++;
                  }
              }printf("%s",a);
          }printf("\n");
          return 0;
      }
      
      • 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
          标签
          (无)
          递交数
          1011
          已通过
          195
          上传者