#encoding:utf-8 No.0522 2014.12.11
while gets
  joi = 0
  ioi = 0
  i = 0

  while i < $_.length - 2
    if $_[i,3] == "JOI"
      joi += 1
    end
    
    if $_[i,3] == "IOI"
      ioi += 1
    end
  end

  puts joi,ioi
end