5 条题解

  • 1
    @ 2025-2-11 14:22:15

    题目分析

    此题目考察了字符串处理的相关知识点。

    代码实现

    #include<iostream>
    #include<string>
    #include<algorithm>
    using namespace std;
    string s;
    char a,b;
    int main(){
    	cin>>s>>a>>b;
    	for(int i=0;i<s.length();i++)s[i]=(s[i]==a)?b:s[i];
    	cout<<s;
        return 0;
    }
    
    
    

    记得给五星好评哦喵~ 谢谢客官啦~

    • 0
      @ 2024-6-30 10:19:56

      brjhgfvdbfrjhsdgbfhdgsfhdgygsyufgsuyguysfguy fguysgfuysgfyugyfugysgfygsyfgsuyg6r236r6g64tgf64g5rf76t65guytgre4tgg78e9tgju8rtgkl-659jyir8fg67efg67gt5h67fegft76rgf7efikjymolek,refopeh4tfghoipwijmeyhfiosm,ldja635e563wgrwf56efg

      • -1
        @ 2024-7-20 14:35:49
        #include<bits/stdc++.h>
        using namespace std;
        string s;
        int main(){
        char ch1,ch2;
        cin>>s>>ch1>>ch2;
        for(int i=0; i<s.size();i++){
        	if(s[i]==ch1){
        		s[i]=ch2;
        	}
        }
        cout<<s;
        	return 0;
        }
        • -1
          @ 2024-7-20 13:47:29

          #include<bits/stdc++.h> using namespace std;
          int main(){ string s; char ch1,ch2; cin>>s>>ch1>>ch2; for(int i=0 ;i<s.size();i++){ if(s[i]==ch1){ s[i]=ch2; } } cout<<s; return 0; }

          • -3
            @ 2024-6-28 17:41:52

            #include<bits/stdc++.h> using namespace std; string s; int main(){ char ch1,ch2; cin>>s>>ch1>>ch2; for(int i = 0;i<s.length();i++){ if(s[i]==ch1){ s[i]=ch2; } } cout<<s; return 0; }

            • 1

            信息

            ID
            2078
            时间
            1000ms
            内存
            256MiB
            难度
            3
            标签
            递交数
            262
            已通过
            131
            上传者