B. String Typing

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input
    ll N; 
    cin>>N;
    
    ll mi = N;
    string s;cin>>s;
    string now="";
    ll sz=0;
    for(char c : s){
      now += c;
      sz++;
      if(sz*2<=N){
        // try copy
        string t = now+now;
        if(t==s.substr(0,2*sz)){
          // copy success
          ll rest = N-2*sz;
          ll cost = sz + 1 + rest;
          chmin(mi,cost);
        }
      }
    }
    p(mi);
    
    return 0;
}