#include
#include
#define INT(X) (X-'0')
using namespace std;
int main()
{
int N;
cin >> N;
int max = 0;
for (int i = 0; i < N; i++) {
int temp = 0;
string s;
cin >> s;
//if (s == "0") break; // 这个条件等于没用,可以删除
int len = s.length();
for (int j = 0; j < len; j++) {
char current = s.at(j);
if (current <= '9' && current >= '0') {
temp = temp*10+INT(current);
}
if (temp > max) {
max = temp;
}
}
}
cout << max;
return 0;
}
#include
#include
using namespace std;
int main()
{
int N;
cin >> N;
while( N != 0 )
{
int res = 0;
string t;
while( N-- ){
cin >> t;
string s = "";
for(unsigned i = 0; i < t.size(); ++i)
if( t[i]>='0' && t[i]<='9' )
s += t[i];
int num = stoi(s);
if( num > res )
res = num;
}
cout << res << endl;
cin >> N;
}
return 0;
}