program t implicit none character(100)::S integer::A=0 integer::i read*,S do i=1,len_trim(S) if(S(i:i)=="m")A=A+1 end do print"(i0)",A end program t