fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. string number;
  6. cin >> number;
  7.  
  8. char maxDigit = '0';
  9. for (char digit : number) {
  10. if (digit > maxDigit) {
  11. maxDigit = digit;
  12. }
  13. }
  14.  
  15. cout << maxDigit << endl;
  16. return 0;
  17. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
0