Run ID:73387
提交时间:2024-05-18 19:01:15
#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; }