Problem: problem

Create a program that counts the number of consecutive JOI or IOI characters in a given character string. The character string consists only of uppercase letters of the alphabet. For example, the character string "JOIOIOI" in the figure below contains JOI in one place and IOI in two places.

<image>



input

The input consists of multiple datasets. Each dataset is one line and consists of uppercase letters of the alphabet of 10,000 characters or less. Input ends with EOF.

The number of datasets does not exceed 5.

output

For each dataset, output the number of JOIs found in the first line and the number of IOIs found in the second line.

Examples

Input

JOIJOI
JOIOIOIOI
JOIOIJOINXNXJIOIOIOJ


Output

2
0
1
3
2
3


Input

None


Output

None

Solution (in PYTHON3):

Solution:
import sys

def main():
    pat1 = 'JOI'
    pat2 = 'IOI'
    lines = sys.stdin.readlines()
    for s in lines:
        l = len(s)
        if l == 1 or l == 2:
            print(0)
            print(0)
            continue

        cnt1 = 0
        cnt2 = 0
        i = 0
        j = 0
        while i < l - 2:
            k = 0
            while True:
                if k >= 3 or s[k + i] != pat1[k]:
                    break
                k += 1
            if k == 3:
                cnt1 += 1
                i += 3
            else:
                i += 1
        while j < l - 2:
            k = 0
            while True:
                if k >= 3 or s[k + j] != pat2[k]:
                    break
                k += 1
            if k == 3:
                cnt2 += 1
                j += 2
            else:
                j += 1

        print(cnt1)
        print(cnt2)


if __name__ == '__main__':
    main()