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

8300번 - Squared Words 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB133604646.465%

문제

A squared word is a word of the form xx, i.e., consisting of a sequence of letters repeated twice. Some examples of squared words in English are the words: couscous, murmur (= a low, continuous sound), tartar (= hardened dental plaque) and hotshots. We would like to find out, for a given word, how many letters should be removed from the word for it to become a squared word (however, not necessarily a correct English word).

입력

The first line of the standard input contains an integer n (1 ≤ n ≤ 1000), denoting the length of the word. The second line contains a word consisting of n lower case English letters.

출력

The first and only line of the standard output should contain a single integer - the minimal number of letters that should be removed from the word for it to become a squared word. We assume that the empty word is a correct squared word.

제한

예제 입력 1

15
tachystoskopach

예제 출력 1

7

힌트

If we remove the letters y, s, o, s, k, o and p, we obtain a squared word tachtach. In Polish, this word represents a (not really well known) kind of a coach.

출처

Contest > Algorithmic Engagements > PA 2010 3-2번

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

출처

대학교 대회

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

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