QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 32 MB Total points: 10

#10664. Squared Words [B]

Statistics

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).

Input Format

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.

Output Format

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.

Example

Input

15
tachystoskopach

Output

7

Notes

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.

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.