Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
120444 罗子童 22数字最多的字符串 C++ Runtime Error 1 MS 272 KB 764 2025-05-25 19:18:19

Tests(0/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[101],s[101]; cin>>a>>s; int a1=strlen(a),s1=strlen(s),a2=0,s2=0; for(int i=0;i<a1;i++){ if(a[i]>='0'&&'9'>=a[i]) a2++; } for(int i=0;i<s1;i++){ if(s[i]>='0'&&'9'>=s[i]) s2++; } if(a2>s2){ for(int i=s1-1;i>=0;i--) cout<<s[i]; cout<<a[a2-1]; } else if (a2<s2){ for(int i=a1-1;i>=0;i--) cout<<a[i]; cout<<s[s2-1]; } return 0; }


Run Info:

*** stack smashing detected ***: ./Main terminated