E - 良い日付 解説 /

実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 7

問題文

YYYY/MM/DD 形式とは日付の表記方法の 1 つで、0 埋めした 4 桁の西暦年、0 埋めした 2 桁の月、 0 埋めした 2 桁の日をスラッシュで区切って並べたものを言います。たとえば 202211 日は 2022/01/01 と表されます。

日付を YYYY/MM/DD 形式で表したときに表れる数字が 2 種類以下であるとき、良い 日付と呼びます。

日付 S が YYYY/MM/DD 形式で与えられます。S 以降の日で はじめて 現れる良い日付を YYYY/MM/DD 形式で出力してください。
ただし、暦はグレゴリオ暦 (現行の日本をはじめ世界各国で使用されている暦) を使用するものとします。

制約

  • S はグレゴリオ暦に現れる日付である。
  • S は YYYY/MM/DD 形式で与えられる。
  • S200111 日以降 29991231 日以前である。

入力

入力は以下の形式で標準入力から与えられる。

S

出力

答えを YYYY/MM/DD 形式で出力せよ。


入力例 1

2022/01/01

出力例 1

2022/02/02

S = 202211 日以降では 202222 日がはじめて条件を満たす日です。
たとえば 2222222 日なども S 以降という条件は満たしていますが、 202222 日より遅い日付なので「はじめて 現れる」という条件を満たしません。


入力例 2

2002/02/22

出力例 2

2002/02/22

入力例 3

2002/02/23

出力例 3

2020/02/02

入力例 4

2999/12/31

出力例 4

3000/03/03

Score : 7 points

Problem Statement

YYYY/MM/DD format is a notation of date, consisting of the zero-padded 4-digit year, zero-padded 2-digit month, and zero-padded 2-digit day, separated by slashes. For example, January 1, 2022 is represented as 2022/01/01.

A date is called good when it has two or fewer different digits in YYYY/MM/DD format.

You are given a date S in YYYY/MM/DD format. Print the first good day not earlier than S, in YYYY/MM/DD format.
Here, we use the Gregorian calendar.

Constraints

  • S is a valid date in the Gregorian calendar.
  • S is given in YYYY/MM/DD format.
  • S is between January 1, 2001 and December 31, 2999 (inclusive).

Input

Input is given from Standard Input in the following format:

S

Output

Print the answer in YYYY/MM/DD format.


Sample Input 1

2022/01/01

Sample Output 1

2022/02/02

The first day that satisfies the condition not earlier than S = January 1, 2022 is February 2, 2022.
There are other good dates such as February 22, 2222 that are not earlier than S, but they are later than February 2, 2022 and not the first good day.


Sample Input 2

2002/02/22

Sample Output 2

2002/02/22

Sample Input 3

2002/02/23

Sample Output 3

2020/02/02

Sample Input 4

2999/12/31

Sample Output 4

3000/03/03