Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
145522 顾文博 22数字最多的字符串 C++ Accepted 0 MS 272 KB 730 2026-01-25 15:55:10

Tests(10/10):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ char a[1001],b[1001]; int s1=0,s2=0; cin>>a>>b; for(int i=0;i<strlen(a);i++) if(a[i]>='0'&&a[i]<='9') s1++; for(int j=0;j<strlen(b);j++) if(b[j]>='0'&&b[j]<='9') s2++; if(s1>s2){ for(int k=strlen(b)-1;k>=0;k--) cout<<b[k]; cout<<a[s1-1]; } else{ for(int k=strlen(a)-1;k>=0;k--) cout<<a[k]; cout<<b[s2-1]; } return 0; }