solutution for TheSimilarNumbers, SRM 568