## CCC '13 J3 - From 1987 to 2013

View as PDF

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

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 2013, 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

• aaron522  commented on Jan. 12, 2020, 6:44 p.m.

:(

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

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

• LiFengxun  commented on Sept. 8, 2018, 8:53 a.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• tonyzheng  commented on Aug. 22, 2018, 8:06 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• harrylu  commented on May 12, 2018, 11:02 a.m.

This comment is hidden due to too much negative feedback. Click here to view it.

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

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

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

Yes, for those 2 cases it will be 10234.

• ZEN  commented on Nov. 27, 2017, 11:03 a.m.

shouldnt 2014 be there too?

• JavaButter  commented on Sept. 5, 2018, 4:49 p.m.
• geese  commented on Oct. 10, 2018, 2:51 p.m. edit 2

No it's not dude dont lie

• Raymo111  commented on Aug. 8, 2018, 11:21 p.m.

No, it shouldn't, because 2 and 4 are the same digit! *sarcastic*

• loltrollkill  commented on Feb. 5, 2018, 9:58 p.m.

finally, somebody noticed that error

• CowTrainer  commented on Feb. 6, 2018, 8:36 p.m.

Yeah, that seemed odd to me