## CCC '13 S1 - From 1987 to 2013

View as PDF

Points: 5
Time limit: 2.0s
Memory limit: 256M

Problem type
##### Canadian Computing Competition: 2013 Stage 1, Junior #3, Senior #1

You might be surprised to know that 2013 is the first year since 1987 with distinct digits. The years 2014, 2015, 2016, 2017, 2018, 2019 each have distinct digits. 2012 does not have distinct digits, since the digit 2 is repeated.

Given a year, what is the next year with distinct digits?

#### Input Specification

The input consists of one integer (), representing the starting year.

#### Output Specification

The output will be the single integer , which is the next year after with distinct digits.

#### Sample Input 1

1987

#### Output for Sample Input 1

2013

#### Sample Input 2

999

#### Output for Sample Input 2

1023

• commented on Sept. 10, 2020, 6:10 p.m.

Do not forget to take in consideration top range of the input. For example: 9999

• commented on Feb. 5, 2020, 12:10 p.m. edited

Can someone explain why I got an IR on my submission? The judge didn't explain what type of invalid return it was.

• commented on Feb. 9, 2020, 1:01 a.m. edited

I would not recommend relying on the judge to tell you what kind of IR you are getting. I would recommend testing your code in whichever ide you are using : ) Furthermore, try testing your code out with the sample input.

• commented on Oct. 20, 2018, 8:37 p.m. edited

lol every time I finish the question I look at the best submission and go :facepalm:

• commented on Oct. 22, 2018, 3:51 p.m. edited

i feel u

• commented on Jan. 13, 2018, 11:03 a.m. edit 5

if input is 9876 or 10000 shouldn't the answer be 10234?

• commented on Jan. 13, 2018, 12:34 p.m. edited

Yes, for those 2 cases it will be 10234.