Practice on Toph
Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.
Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.
Babu Bhai (:p) is a student of AUST. He has some favorite numbers. His favorite numbers are those number that has only one distinct digit. Example: 7, 88, 222, 9999, etc. 123, 122, 33344 are not his favorite numbers. Now, you are given an positive integer N. You have to find a positive favorite number for Babu Bhai not greater that N.
A single integer N. 1 <= N <= 1000.
A single integer M(Favorite Number of Babu Bhai). (1 <= M <= N)
If there is multiple possible solution print any of them. It is guarented that for the given N solution always exists.
Input | Output |
---|---|
100 | 99 |
88, 77, 66… are also acceptable. |
Input | Output |
---|---|
99 | 99 |