Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
76954 万隽宇 22数字最多的字符串 C++ Accepted 1 MS 272 KB 641 2024-06-06 19:13:50

Tests(10/10):


Code:

#include<iostream>//0=65 #include<cstring> using namespace std; int main(){ int c=0,d=0; char s[1000],t[1000]; cin.getline(s,1000); cin.getline(t,1000); for(int i=0;strlen(s)>i;i++){ if(s[i]>='0' && s[i]<='9'){ c++; } } for(int i=0;strlen(t)>i;i++){ if(t[i]>='0' && t[i]<='9'){ d++; } } if(c>d){ for(int i=strlen(t)-1;0<=i;i--) cout<<t[i]; cout<<s[c-1]; } else{ for(int i=strlen(s)-1;0<=i;i--) cout<<s[i]; cout<<t[d-1]; } return 0; }