import java.util.Scanner; public class TaskJ { public static void main(String[] args) { Scanner cin = new Scanner(System.in); String s = cin.next(); int ans = 0; for (int i = 0; i < s.length(); ++i) { if (s.charAt(i) == 'm') ans++; } System.out.println(ans); } }