PROBLEM LINK:
Author: Hanzala Sohrab
DIFFICULTY:
EASY
QUICK EXPLANATION:
As can be seen by a little rough work, the answer is the largest digit in the given number.
SOLUTION:
Setter's Solution
#include<iostream>
#include<string>
#include<math.h>
using std::cout;
using std::cin;
using std::string;
using std::max;
int main()
{
cin.sync_with_stdio(false);
cin.tie(0);
int T;
cin >> T;
while (T--)
{
string N;
cin >> N;
int m = 0;
for (int i = 0; i < N.size(); ++i)
m = max(m, N[i] - 48);
cout << m << '\n';
}
return 0;
}