3 条题解

  • 0
    @ 2023-6-3 9:16:08
    #include<bits/stdc++.h>
    using namespace std;
    char a[1500];
    int main(){
    	gets(a);
    	for(int i=0;i<strlen(a);i++){
    		if(a[i]=='r'&&a[i+1]=='u'&&a[i+2]=='l'&&a[i+3]=='e'&&a[i+4]=='r'){
    			cout<<"book";
    			i+=5;
    		}
    		cout<<a[i];
    	}
    }
    
    • 0
      @ 2023-5-28 16:09:35
      #include<bits/stdc++.h>
      using namespace std;
      string s;
      int main(){
      	int pos=0;
      	getline(cin,s);
      	while(pos>-1){
      		pos=s.find("ruler",0);
      		if(pos>-1){
      			s.replace(pos,5,"book");
      		}
      	}
      	cout<<s;
      	return 0;
      }
      
      • 0
        @ 2023-5-28 16:00:02
        #include<bits/stdc++.h>
        using namespace std;
        string a[1145],s;
        int main(){
        	int i=0;
        	while(cin>>s){
        		int pos=s.find("ruler",0);
        		if(pos>-1){
        			s.replace(pos,5,"book");
        		}
        		a[++i]=s;
        	}
        	cout<<a[1];
        	for(int j=2;j<=i;j++){
        		cout<<" "<<a[j];
        	}
        	return 0;
        }
        
        • 1

        信息

        ID
        1146
        时间
        1000ms
        内存
        128MiB
        难度
        5
        标签
        递交数
        25
        已通过
        12
        上传者