let length_accent s =
let size = String.length s
and i = ref 0 in
let final_size = ref size in
while !i < size do
match s.[!i] with
'A'..'Z' | 'a'..'z' -> incr i
| _ -> decr final_size; i := !i + 2
done;
!final_size
;;
let nth s pos =
let i = ref 0
and real_pos = ref 0
and get pos =
match s.[pos] with
'A'..'Z' | 'a'..'z' -> s.[pos]
| _ -> s.[pos + 1]
in
while (!i < pos) do
match s.[!real_pos] with
'A'..'Z' | 'a'..'z' -> incr i; incr real_pos
| _ -> incr i; real_pos := !real_pos + 2
done;
get !real_pos
;;