### 2013 Canadian Computing Competition, Stage 1

## Problem J3/S1: From 1987 to 2013

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

The input consists of one integer `Y`
(0 ≤ `Y` ≤ 10000), representing the starting
year.

### Output

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

### Sample Input 1

1987

### Sample Output 1

2013

### Sample Input 2

999

### Sample Output 2

1023

All Submissions

Best Solutions

**Point Value:** 5

**Time Limit:** 2.00s

**Memory Limit:** 16M

**Added:** May 18, 2013

**Languages Allowed:**

C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

## Comments (Search)

Willon Feb 07, 2014 - 7:29:21 pm UTC Modulus function doesn't workAlexon Feb 08, 2014 - 7:44:40 pm UTC Re: Modulus function doesn't workFor now, it can be circumvented by putting a space after the % sign.