character(10)::S integer::n read *,S n=len_trim(S) if(S(n-1:n)=='ai') then print *,S(1:n-2),'AI' else print *,S(1:n),'-AI' end if end