Language: C++

use std::io::stdin;
use std::vec::Vec;

mod utils {
    use std::io::BufRead;
    use std::str::{self, FromStr};

    pub struct StdinReader<R: BufRead> {
        reader: R,
        buf: Vec<u8>,
    }

    impl<R: BufRead> StdinReader<R> {
        pub fn new(reader: R) -> StdinReader<R> {
            StdinReader {
                reader: reader,
                buf: Vec::new(),
            }
        }

        #[allow(unused)]
        #[inline]
        pub fn reads<T: FromStr>(&mut self) -> T {
            self.read_until(b' ')
        }

        #[allow(unused)]
        #[inline]
        pub fn readl<T: FromStr>(&mut self) -> T {
            self.read_until(b'\n')
        }

        #[allow(unused)]
        #[inline]
        pub fn read_vec<T: FromStr>(&mut self) -> Vec<T> {
            return self.read_until::<String>(b'\n').trim().split_whitespace().map(|c| c.parse().ok().unwrap()).collect();
        }

        #[inline]
        pub fn read_until<T: FromStr>(&mut self, delim: u8) -> T {
            loop {
                self.buf.clear();
                let len = self.reader
                    .read_until(delim, &mut self.buf)
                    .expect("failed reading bytes");
                match len {
                    0 => panic!("early eof"),
                    1 if self.buf[0] == delim => (),
                    _ => {
                        if self.buf[len - 1] == delim {
                            self.buf.truncate(len - 1);
                        }
                        break;
                    }
                }
            }

            let elem = unsafe { str::from_utf8_unchecked(&self.buf) };
            elem.parse().unwrap_or_else(|_| panic!(format!("failed parsing: {}", elem)))
         }
    }
}

pub fn split_s_to_vec(s:&String, len: usize) -> Vec<String> {
    let mut res:Vec<String> = Vec::new();
    for i in 0..(s.len() - len + 1) {
        let t = match s.get(i..(i + len)) {
            Some(u) => u.to_string(),
            None => {
                continue
            }
        };
        res.push(t);
    }
    res
}

fn main(){
    let stdin = stdin();
    let mut r = utils::StdinReader::new(stdin.lock());
    let n:u16 = r.readl();
    let s:String = r.readl();

    let dp_len = (n - n%2) / 2 + 1;

    let mut res = 0;

    for i in 1..(dp_len) {
        let mut tar = split_s_to_vec(&s, i as usize);
        tar.sort();
        for j in 0..(tar.len() - 1) {
            if(tar[j] == tar[j + 1]){
                res = i;
                continue
            }
        }
    }

    println!("{}",res);
}



Compiler output:
a.cc:21:10: error: invalid preprocessing directive #[
   21 |         #[allow(unused)]
      |          ^
a.cc:22:10: error: invalid preprocessing directive #[
   22 |         #[inline]
      |          ^
a.cc:27:10: error: invalid preprocessing directive #[
   27 |         #[allow(unused)]
      |          ^
a.cc:28:10: error: invalid preprocessing directive #[
   28 |         #[inline]
      |          ^
a.cc:33:10: error: invalid preprocessing directive #[
   33 |         #[allow(unused)]
      |          ^
a.cc:34:10: error: invalid preprocessing directive #[
   34 |         #[inline]
      |          ^
a.cc:39:10: error: invalid preprocessing directive #[
   39 |         #[inline]
      |          ^
a.cc:66:14: error: too many decimal points in number
   66 |     for i in 0..(s.len() - len + 1) {
      |              ^~~
a.cc:88:14: error: too many decimal points in number
   88 |     for i in 1..(dp_len) {
      |              ^~~
a.cc:91:18: error: too many decimal points in number
   91 |         for j in 0..(tar.len() - 1) {
      |                  ^~~
a.cc:1:1: error: 'use' does not name a type
    1 | use std::io::stdin;
      | ^~~
a.cc:2:1: error: 'use' does not name a type
    2 | use std::vec::Vec;
      | ^~~
a.cc:4:1: error: 'mod' does not name a type
    4 | mod utils {
      | ^~~
a.cc:64:1: error: 'pub' does not name a type
   64 | pub fn split_s_to_vec(s:&String, len: usize) -> Vec<String> {
      | ^~~
a.cc:78:1: error: 'fn' does not name a type
   78 | fn main(){
      | ^~