Under construction

Still being built. Things may change

Periodic String

Time limit2sMemory limit2048 MB

Summary
Given a string S of length N, the task is to check whether S is some string T repeated at least twice, printing Yes or No.
Level

Easy2 of 10

Topics
String, Brute force
Solved
No attempts yet

Problem

A string SS of length NN is given. Each character of SS is a lowercase English letter.

If there exist a string TT and an integer mm (2≤m2 \le m) such that concatenating TT mm times in order gives SS, then SS is called periodic.

Print Yes if SS is periodic, and No otherwise.

Input

The input is given in the following format.

N
S

Output

Print Yes if SS is periodic, and No otherwise. Print nothing other than the answer, including no prompts for input.

Constraints

  • 2≤N≤10002 \le N \le 1000.
  • SS is a string of length NN.
  • Each character of SS is a lowercase English letter.
  • NN is an integer.

Examples4

  1. Example 1

    Input
    6
    ababab
    
    Expected output
    Yes
    
  2. Example 2

    Input
    7
    abcabca
    
    Expected output
    No
    
  3. Example 3

    Input
    2
    aa
    
    Expected output
    Yes
    
  4. Example 4

    Input
    8
    ababcdcd
    
    Expected output
    No