import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No00000418_Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { String s = br.readLine(); int cnt = 0; for(int i = 0; i < s.length(); i++) { if(s.charAt(i) == 'm') cnt++; } System.out.println(cnt); } }