VVVV

刘泽熙  •  6个月前


#include <bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int len=s.length(); for(int i=0;i<len;i++){ if(s[i]=='A'){ s[i]='T'; }else if(s[i]=='T'){ s[i]='A'; }else if(s[i]=='G'){ s[i]='C'; }else if(s[i]=='C'){ s[i]='G'; } } cout<<s; return 0; }


评论:

#include <iostream> #include <string> std::string processWord(const std::string& word) { // 检查前缀是否为 "re-", "dis-" 或 "ab-" if (word.substr(0, 3) == "re-" || word.substr(0, 3) == "dis" || word.substr(0, 3) == "ab-") { return word.substr(3); } else { return word; } } int main() { std::string word; std::cin >> word; std::cout << processWord(word) << std::endl; return 0; }

 


张黄源  •  6个月前