P23596 [AtCoder] Heyho and Deletion
普及+
题目描述

Problem Description

A string that is formed by repeating a certain string twice is called a square. For example, abcabc and abababab are squares, but abc and ababab are not. Note that a string of length $0$ is also considered a square.

One day, Heyho found a string $S$ consisting only of lowercase English letters on the street. Heyho, who loves squares, decided to obtain a square by repeatedly performing the following operation on string $S$:

  • Choose an integer $p$ such that $1 \leq p \leq |S|$. Then, delete the $p$-th character of $S$. Here, $|S|$ denotes the length of $S$.

Find the minimum number of operations required for Heyho to obtain a square.

Input Format

The input is given from the standard input in the following format:

$ N $ $ S $

  • The first line contains an integer $N$ $(1 \leq N \leq 100)$, which represents the length of the string Heyho found.
  • The second line contains the string $S$, which is guaranteed to be a string of $N$ lowercase English letters.

Output Format

Output the minimum number of operations required for Heyho to obtain a square on a single line. End the output with a newline.

Sample Input and Output

Sample Input #1

8
abacbabc

Sample Output #1

2

Sample Input #2

8
abababab

Sample Output #2

0

Sample Input #3

5
abcde

Sample Output #3

5

Sample Input #4

26
codefestivaltwozeroonefive

Sample Output #4

14

Notes/Hints

Sample Explanation 1

By performing the following $2$ operations, you can obtain the square abcabc:
- Delete the $5$th character to get abacabc.
- Delete the $3$rd character to get abcabc.

Sample Explanation 2

Since abababab is already a square, no operations are needed.

Sample Explanation 3

By deleting all characters, you can obtain a square of length $0$.

Sample Explanation 4

You can obtain the square oefiveoefive.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
8 abacbabc
样例输出
2