Logo
(追記) (追記ここまで)

19422번 - Almost Bobo Number 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB4000.000%

문제

A positive integer is called a bobo number if its decimal representation can be obtained by concatenating two copies of the same integer. For example, 12341234ドル$ and 3232ドル$ are bobo numbers, while 1234321ドル$ and 1322ドル$ are not.

A positive integer is called an almost bobo number if, after merging all the consecutive equal digits, the resulting number is a bobo number. For example, $\underbrace{111}\underbrace{222}\underbrace{3}\underbrace{11}\underbrace{22}\underbrace{33}$ becomes 123123ドル$ after merging all the consecutive equal digits, and thus is an almost bobo number.

Bobo has a very large number $n,ドル and he would like to know the largest almomst bobo number less than $n$.

입력

The input contains zero or more test cases, and is terminated by end-of-file. For each test case:

The first line contains an integer $n$ without leading zeros (1ドル \leq n \leq 10^{5,000円,000円}$).

It is guaranteed that the total length of the decimal representations of all $n$ in the input does not exceed 5ドル,000円,000円$.

출력

For each test case, output an integer without leading zeros denoting the largest almomst bobo number strictly less than $n$. If there is no such integer, output $-1$ instead.

제한

예제 입력 1

12345
67890
11111
1000
26782641

예제 출력 1

12212
67767
11010
-1
26777267

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2017 > Day 9. Xi Lin Contest, Grand Prix of China A번

Contest > Open Cup > 2016/2017 Season > Stage 11: Grand Prix of China A번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /