Imagine an alphabet of words.
Example:
a ==> 1 b ==> 2 c ==> 3 z ==> 26 ab ==> 27 ac ==> 28 az ==> 51 bc ==> 52
This is a combination of two problems: parsing a number in a base that isn't 10 and determining if input is sorted.
Note that, since this is probably homework, you probably can't just use existing methods to do the hard work.