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

7966번 - Template 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 128 MB143543331.731%

문제

Byteasar wants to put a rather long pattern on his house. In order to do this, he has to prepare an appropriate template with letters cut off first. He is going to put the pattern on the wall by putting the pattern on the wall in the appropriate place and painting over it. This way he can "print" all the letters that are on the template at one time (it is not possible to "print" only some of them). It is, however, possible, to paint some letters on the wall several times, as a result of different applications of the template. The letters on the template are adjacent (there are no spaces on it). Of course, it is possible to prepare a template with the whole pattern on it. But Byteasar would like to minimize the cost, so he wants to make a template as short as possible.

Write a programme that:

  • reads from the standard input the pattern Byteasar wants to put on his house,
  • determines the minimal length of the template needed to do it,
  • writes the result to the standard output.

입력

In the first and only line of the standard input there is one word. It is the pattern Byteasar wants painted on his house. It consists of no more than 500,000 and no less than 1 lower-case (non-capital) letters of the English alphabet.

출력

In the first and only line of the standard output one integer should be written - the minimal number of letters in the template.

제한

예제 입력 1

ababbababbabababbabababbababbaba

예제 출력 1

8

힌트

출처

Olympiad > Polish Olympiad in Informatics > POI 2004/2005 > Stage 2 5번

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

출처

대학교 대회

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

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