Solution for find digits problem