eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач
Задачи

Different Digits

Different Digits

The inhabitants of Nlogonia are very superstitious. One of their beliefs is that street house numbers that have a repeated digit bring bad luck for the residents. Therefore, they would never live in a house which has a street number like \textbf{838} or \textbf{1004}. The Queen of Nlogonia ordered a new seaside avenue to be built, and wants to assign to the new houses only numbers without repeated digits, to avoid discomfort among her subjects. You have been appointed by Her Majesty to write a program that, given two integers \textbf{N} and \textbf{M}, determines the maximum number of houses that can be assigned street numbers between \textbf{N} and \textbf{M}, inclusive, that do not have repeated digits. \InputFile Each test case is described using one line. The line contains two integers \textbf{N} and \textbf{M}, as described above (\textbf{1 }≤ \textbf{N} ≤ \textbf{M} ≤ \textbf{5000}). \OutputFile For each test case output a line with an integer representing the number of street house numbers between \textbf{N} and \textbf{M}, inclusive, with no repeated digits.
Лимит времени 1 секунда
Лимит использования памяти 64 MiB
Входные данные #1
87 104
989 1022
22 25
1234 1234
Выходные данные #1
14
0
3
1
Источник ACM ICPC Regional Latino America 2012