Scanf.scanf "%d %s %s" (fun n s t ->
    let rec loop dup =
        if dup = 0 then dup else
            let rec loop2 a b =
                if b < 0 then dup else
                    if s.[a] = t.[b] then loop2 (a - 1) (b - 1)
                    else loop (dup - 1)
            in
            loop2 (n - 1) (dup - 1)
    in
    let dup = loop n in
    Printf.printf "%d\n" (n * 2 - dup)
)