#!/usr/bin/env python #coding:utf8 def read(): return raw_input() def work(s): print s.count('m') if __name__ == "__main__": work(read())