This page is still under construction.

Parts of this page are still being built. What you see may change.

JOI and IOI

Interview

Time limit1sMemory limit128 MB

Summary
Count how many length-3 windows of a string equal JOI and how many equal IOI, including overlaps.
Level

Easy1 of 10

Topics
String, Brute force, Implementation
Solved
No attempts yet

Problem

You are given a string consisting only of uppercase letters. Write a program that counts how many times three consecutive characters form JOI and how many times they form IOI, and prints both counts.

Overlapping occurrences are counted separately. For example, JOIOIOI contains JOI once and IOI twice.

Input

The first line contains a string of length at most 10000, consisting only of uppercase letters.

Output

Print the number of occurrences of JOI on the first line, and the number of occurrences of IOI on the second line.

Examples3

  1. Example 1

    Input
    JOIJOI
    
    Expected output
    2
    0
    
  2. Example 2

    Input
    JOIOIOIOI
    
    Expected output
    1
    3
    
  3. Example 3

    Input
    JOIOIJOINXNXJIOIOIOJ
    
    Expected output
    2
    3