Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
73392 LJY 字符串中最大的数字II C++ Accepted 1 MS 280 KB 452 2024-05-18 19:06:27

Tests(10/10):


Code:

#include <iostream> #include <string> #include <cctype> // For isdigit function using namespace std; int main() { string input; cin >> input; char maxDigit = '0'; // 初始化为最小的数字字符 // 遍历字符串寻找最大的数字字符 for (char ch : input) { if (isdigit(ch) && ch > maxDigit) { maxDigit = ch; } } cout << maxDigit << endl; return 0; }