Problem:
Score : 200 points

Problem Statement

Given are a positive integer N and a string S of length N consisting of lowercase English letters.

Determine whether the string is a concatenation of two copies of some string.
That is, determine whether there is a string T such that S = T + T.

Constraints

1 \leq N \leq 100

S consists of lowercase English letters.

|S| = N

Input

Input is given from Standard Input in the following format:

N
S

Output

If S is a concatenation of two copies of some string, print Yes; otherwise, print No.

Sample Input 1

6
abcabc

Sample Output 1

Yes

Let T = abc, and S = T + T.

Sample Input 2

6
abcadc

Sample Output 2

No

Sample Input 3

1
z

Sample Output 3

No

Solution in Rust (1.15.1) (judge verdict: Accepted)

fn main(){
    let n: usize = linp();
    let s: String = linp();
    println!("{}",
        if n % 2 != 0{
            "No"
        }else if &s[0..n/2] == &s[n/2..]{
            "Yes"
        }else{
            "No"
        }
    );
}

// easy IOs
trait SimpleParse{
    fn simple_parse(s: &str) -> Self;
    fn get_slice_index(s: &str) -> Option<usize>{
        s.find(|c|{c == ' ' || c == '\t' || c == '\n'})
    }
    fn next_vec_item<'a>(s: &'a str) -> Option<&'a str>{
        match s.find(|c|{!(c == ' ' || c == '\t' || c == '\n')}){
            Some(i) => Some(&s[i..]),
            None => None
        }
    }
}
macro_rules! new_parse{
    ( $t:ty ) => {
        impl SimpleParse for $t{
            fn simple_parse(s: &str) -> Self{
                s.trim().parse().expect("input parse error")
            }
        }
    }
}
macro_rules! new_tparse{
    ( $a:ident: $A:ident; $($x:ident: $X:ident, $y:ident: $Y:ident);* ) => {
        impl<$A, $($Y),*> SimpleParse for ($A, $($Y),*)
        where $A: SimpleParse, $($Y: SimpleParse),* {
            fn simple_parse($a: &str) -> Self{
                $(
                    let $x = $x.trim();
                    let ($x, $y) = $x.split_at(
                            $X::get_slice_index($x)
                            .expect("not enough inputs")
                    );
                )*
                ($A::simple_parse($a), $($Y::simple_parse($y)),*)
            }
            fn get_slice_index(s: &str) -> Option<usize>{
                let ret = $A::get_slice_index(s);
                $(
                    let ret = ret.expect("not enough inputs");
                    let ret = (&s[ret..])
                        .find(|c|{!(c == ' ' || c == '\t' || c == '\n')})
                        .expect("not enough inputs");
                    let ret = $Y::get_slice_index(&s[ret..]);
                )*
                ret
            }
        }
    }
}
impl SimpleParse for String{
    fn simple_parse(s: &str) -> String{
        String::from(s.trim())
    }
}
impl SimpleParse for char{
    fn simple_parse(s: &str) -> char{
        if s.len() != 1{
            panic!("char input error");
        }
        s.chars().nth(0).unwrap()
    }
    fn get_slice_index(s: &str) -> Option<usize>{
        if s.len() < 1{
            None
        }else{
            Some(1)
        }
    }
    fn next_vec_item<'a>(s: &'a str) -> Option<&'a str>{
        if s.len() == 0{
            None
        }else{
            Some(s)
        }
    }
}
impl<T> SimpleParse for Vec<T>
where T: SimpleParse{
    fn simple_parse(s: &str) -> Vec<T>{
        let mut ret: Vec<T> = Vec::new();
        let mut s = s.trim();
        if s.len() == 0{
            return ret;
        }
        loop{
            match T::get_slice_index(s){
                Some(i) => {
                    let (a, b) = s.split_at(i);
                    ret.push(T::simple_parse(a));
                    match T::next_vec_item(b){
                        Some(ss) => {s = ss;}
                        None => {return ret;}
                    }
                }
                None => {
                    ret.push(T::simple_parse(s));
                    return ret;
                }
            }
        }
    }
    fn get_slice_index(_: &str) -> Option<usize>{
        None
    }
}
impl<A> SimpleParse for (A,)
where A: SimpleParse {
    fn simple_parse(s: &str) -> Self{
        (A::simple_parse(s),)
    }
}
new_parse!(i8);
new_parse!(u8);
new_parse!(i16);
new_parse!(u16);
new_parse!(i32);
new_parse!(u32);
new_parse!(i64);
new_parse!(u64);
new_parse!(f32);
new_parse!(f64);
new_parse!(isize);
new_parse!(usize);
new_tparse!(a:A; a:A,b:B);
new_tparse!(a:A; a:A,b:B; b:B,c:C);
new_tparse!(a:A; a:A,b:B; b:B,c:C; c:C,d:D);
new_tparse!(a:A; a:A,b:B; b:B,c:C; c:C,d:D; d:D,e:E);
new_tparse!(a:A; a:A,b:B; b:B,c:C; c:C,d:D; d:D,e:E; e:E,f:F);
new_tparse!(a:A; a:A,b:B; b:B,c:C; c:C,d:D; d:D,e:E; e:E,f:F; f:F,g:G);
new_tparse!(a:A; a:A,b:B; b:B,c:C; c:C,d:D; d:D,e:E; e:E,f:F; f:F,g:G; g:G,h:H);
#[allow(dead_code)]
fn lin() -> String{
    let mut input = String::new();
    let _ = std::io::stdin().read_line(&mut input).expect("input error");
    input
}
#[allow(dead_code)]
fn linp<A: SimpleParse>() -> A{
    A::simple_parse(lin().trim())
}