PivotOJ

ZGODAN

시간 제한: 1000ms메모리 제한: 32MB출처: COCI 2014-2015BOJ 10646

문제

An integer is considered handsome if every two of its consecutive digits are of different parity. For a given integer N, what is its closest handsome number?

Please note: Numbers consisting of only one digit are handsome numbers. The distance of two numbers is the absolute value of their difference.

입력

The first and only line of input contains the positive integer N that consists of at most thousand digits and is not handsome.

출력

The first and only line of output must contain the required closest handsome number. If two closest numbers exist, output the smaller number first and then the larger one and separate them by a single space.

예제

예제 1

입력
13
출력
12 14

예제 2

입력
5801001
출력
5810101
코드를 제출하려면 로그인하세요.