
fun main(args:Array<String>):Unit{
    loop@while(true){
        val line = readLine()
        when(line){
            null -> break@loop
            else -> {
                var joi = 0
                var ioi = 0
                for (i in 1 until (line.length - 1)){
                    if (line[i] == 'O' && line[i + 1] == 'I'){
                        when(line[i - 1]){
                            'I' -> ++ioi
                            'J' -> ++joi
                        }
                    }
                }
                println(joi)
                println(ioi)
            }
        }
    }
}
