#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
using namespace std;
int main ()
{
int n;
int a [60];
char b [10];
while ( scanf ("%d", &n) && n ) {
int i;
for ( i = 0; i < n; i++ )
scanf ("%d", & a [i]);
for ( i = 0; i < n; i++ ) {
int j = 0;
while ( a [i] ) {
b [j++] = (a [i] % 10) + 48;
a [i] /= 10;
}
b [j] = '';
sort (b, b + j);
a [i] = atoi (b);
}
int max = 0;
for ( i = 0; i < n; i++ ) {
if ( a [i] > max )
max = a [i];
}
printf ("%d\n", max);
}
return 0;
}
Published by Shahab
Completed B.Sc in CSE, @United International University, Dhaka.
Currently working as Development Engineer, Android and iOS Application.
View all posts by Shahab