Successful solution for Chef and Digits problem - http://www.codechef.com/APRIL14/problems/ADIGIT