#include <bits/stdc++.h>
using namespace std;
/*
在一大串数字和字符中,输出最大的数字串
样例:
输入:helloworld123heilllljsahkjfha1456872
输出:1456872
*/
int main()
{
long max = 0;
string s;
string str; cin >> str;
for (int i = 0; i < str.length();){
while (str[i] >= '0' && str[i] <= '9')
{
s += str[i++];
}
if (s.size()>1 && atoi(s.c_str())>max) max = atoi(s.c_str()), s.clear();
++i;
}
cout << max << endl;

return 0;
}

相关文章:

  • 2021-04-09
  • 2021-12-15
  • 2021-09-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2021-11-23
猜你喜欢
  • 2021-06-06
  • 2021-07-09
  • 2021-08-05
  • 2021-12-26
  • 2022-01-30
  • 2022-12-23
  • 2021-09-29
相关资源
相似解决方案