Editorial for JDCC '15 Contest 1 P4 - Basically Right
Submitting an official solution before solving the problem yourself is a bannable offence.
It helps to know about the integer parsing functions part of most languages that accepts a base to interpret the string in. Using this method and checking all the strings will give an approximate solution on the number of valid bases which runs in time.
However, if you experiment with a few numbers you will find that the highest mark is in either the highest or lowest base possible. Thus, we find the highest digit in the two numbers. The lowest base possible is one greater than the highest digit. The highest base as stated in the problem is one less than the denominator. Just check the two numbers and print the maximum.