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

33135번 - Append and Panic! 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
0.5 초 (추가 시간 없음) 2048 MB28723020382.857%

문제

Today is Gabriel’s first day at his new job, and he has been given his first task. He needs to read a string made up of uppercase letters from a file, sort the letters in the string alphabetically, filter out repeated letters, and then write the result back to the original file. For instance, sorting the string “ICPC” would produce “CCIP”, which would become “CIP” after removing repeated letters. Easy, right?

However, Gabriel made a tiny mistake. Instead of overwriting the file with the filtered string, he accidentally appended it to the file. Now, the file is corrupted, containing the original string followed by the sorted, duplicate-free version of it, and Gabriel is in a bit of a panic.

Given the content of the corrupted file, can you determine the length of the original string? Gabriel is confident that with this information, he will be able to complete his assigned task.

입력

The input consists of a single line that contains a string $S$ made up of uppercase letters (2ドル ≤ |S| ≤ 2000$), which is the concatenation of the original (uncorrupted) string $t$ and the sorted, duplicate-free version of $t$.

출력

Output a single line with an integer indicating the length of $t$.

제한

예제 입력 1

ICPCCIP

예제 출력 1

4

예제 입력 2

ABEDCCCABCDE

예제 출력 2

7

예제 입력 3

ZZ

예제 출력 3

1

힌트

출처

ICPC > Regionals > Latin America > Latin America Regional Contests > Latin America Regional Contests 2024 A번

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

출처

대학교 대회

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

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