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

11608번 - Complexity 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB70335528951.332%

문제

Define the complexity of a string to be the number of distinct letters in it. For example, the string string has complexity 6 and the string letter has complexity 4.

You like strings which have complexity either 1 or 2. Your friend has given you a string and you want to turn it into a string that you like. You have a magic eraser which will delete one letter from any string. Compute the minimum number of times you will need to use the eraser to turn the string into a string with complexity at most 2.

입력

The input consists of a single line that contains a single string of at most 100 lowercase ASCII letters (‘a’–‘z’).

출력

Print, on a single line, the minimum number of times you need to use the eraser.

제한

예제 입력 1

string

예제 출력 1

4

예제 입력 2

letter

예제 출력 2

2

예제 입력 3

aaaaaa

예제 출력 3

0

예제 입력 4

uncopyrightable

예제 출력 4

13

예제 입력 5

ambidextrously

예제 출력 5

12

예제 입력 6

assesses

예제 출력 6

1

예제 입력 7

assassins

예제 출력 7

2

힌트

출처

ICPC > Regionals > North America > Pacific Northwest Regional > 2015 Pacific Northwest Region Programming Contest > Division 2 P번

ICPC > Regionals > North America > Southeast USA Regional > 2015 Southeast USA Regional Programming Contest > Division 1 I번

ICPC > Regionals > North America > Southeast USA Regional > 2015 Southeast USA Regional Programming Contest > Division 2 J번

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

출처

대학교 대회

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

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