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

Source: aizu | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
while True:
	try:
		j = input()
		p = 0
		q = 0
		for i in range(len(j) - 2):
			if j[i:i + 3] == 'JOI':
				p += 1
			elif j[i:i + 3] == 'IOI':
				q += 1
			else:
				pass
		print(p)
		print(q)
	except EOFError:
		break


while True:
	try:
		s = input()
	except:
		break
	joi = 0
	ioi = 0
	s_list = [s[i:i + 3] for i in range(len(s) - 2)]
	for i in s_list:
		if i == 'JOI':
			joi += 1
		if i == 'IOI':
			ioi += 1
	print(joi)
	print(ioi)


import sys
from sys import stdin
input = stdin.readline

def find_pattern(txt, p):
	count = 0
	i = txt.find(p, 0)
	while i != -1:
		count += 1
		i = txt.find(p, i + 1)
	return count

def main(args):
	for line in sys.stdin:
		print(find_pattern(line, 'JOI'))
		print(find_pattern(line, 'IOI'))
main(sys.argv[1:])


while True:
	try:
		s = input('')
	except:
		break
	cut_s_list = [s[i:i + 3] for i in range(len(s[:-2]))]
	n_joi = 0
	n_ioi = 0
	for cut_s in cut_s_list:
		if cut_s == 'JOI':
			n_joi += 1
		if cut_s == 'IOI':
			n_ioi += 1
	print(n_joi)
	print(n_ioi)


while True:
	try:
		m = str(input())
		if m == 'EOF':
			break
	except EOFError:
		break
	j = 'JOI'
	i = 'IOI'
	J = 0
	I = 0
	l = ''
	for a in range(0, len(m) - 2):
		l = m[a:a + 3]
		if l == j:
			J += 1
		if l == i:
			I += 1
	print(J)
	print(I)


while True:
	try:
		text = input()
	except:
		break
	joi = 0
	ioi = 0
	while len(text) > 2:
		textlist = list(text)
		judgetext = ''.join(textlist[0:3])
		x = judgetext.find('JOI')
		y = judgetext.find('IOI')
		if x == -1 and y == -1:
			pass
		if x == 0:
			joi += 1
		if y == 0:
			ioi += 1
		del textlist[0]
		text = ''.join(textlist)
	print(joi)
	print(ioi)


import sys
for e in sys.stdin:
	s = sum(((e[i:i + 3] == 'JOI') + 1j * (e[i:i + 3] == 'IOI') for i in range(len(e) - 3)))
	print(int(s.real))
	print(int(s.imag))


while True:
	try:
		input_s = input()
	except:
		break
	s_list = [input_s[i:i + 3] for i in range(len(input_s[:-2]))]
	n_joi = 0
	n_ioi = 0
	for s in s_list:
		if s == 'JOI':
			n_joi += 1
		if s == 'IOI':
			n_ioi += 1
	print(n_joi)
	print(n_ioi)


import sys
counter = 0
A = []
for e in sys.stdin:
	str = e.replace('\n', '')
	A.append(0)
	A.append(0)
	for i in range(len(str) - 2):
		if str[i:i + 3] == 'JOI':
			A[counter] += 1
		elif str[i:i + 3] == 'IOI':
			A[counter + 1] += 1
	counter += 2
for k in range(len(A)):
	print(A[k])


import re
match = re.findall('[0-9]+', 'xxxx1aaaa22cc333ssss')
while True:
	try:
		s = input()
	except:
		break
	joi = ioi = 0
	for i in range(len(s) - 2):
		if s[i + 1] == 'O' and s[i + 2] == 'I':
			if s[i] == 'J':
				joi += 1
			if s[i] == 'I':
				ioi += 1
	print(joi, ioi, sep='\n')


while 1:
	try:
		a = input()
	except:
		break
	b = c = 0
	for i in range(len(a) - 2):
		if a[i:i + 3] == 'JOI':
			b += 1
		elif a[i:i + 3] == 'IOI':
			c += 1
	print(b)
	print(c)


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)
main()


while True:
	try:
		s = input().strip()
	except:
		break
	i = 0
	(cnt_joi, cnt_ioi) = (0, 0)
	while i < len(s) - 2:
		t = s[i:i + 3]
		if t == 'JOI':
			cnt_joi += 1
			i += 2
		elif t == 'IOI':
			cnt_ioi += 1
			i += 2
		elif t[2] == 'O':
			i += 1
		elif t[2] in 'IJ':
			i += 2
		else:
			i += 3
	print(cnt_joi)
	print(cnt_ioi)


while 1:
	try:
		s = input()
		joi = 0
		ioi = 0
		for i in range(len(s) - 2):
			oi = s[i] + s[i + 1] + s[i + 2]
			if oi == 'JOI':
				joi += 1
			elif oi == 'IOI':
				ioi += 1
		print(joi)
		print(ioi)
	except:
		break


while True:
	try:
		d = input()
		D = list(d)
		J = 0
		I = 0
		for i in range(len(D) - 2):
			if D[i] == 'J' and D[i + 1] == 'O' and (D[i + 2] == 'I'):
				J += 1
			if D[i] == 'I' and D[i + 1] == 'O' and (D[i + 2] == 'I'):
				I += 1
		print(J)
		print(I)
	except EOFError:
		break


while True:
	try:
		ss = input()
		ans1 = ans2 = 0
		for i in range(len(ss) - 2):
			if ss[i] == 'J' and ss[i + 1] == 'O' and (ss[i + 2] == 'I'):
				ans1 += 1
			elif ss[i] == 'I' and ss[i + 1] == 'O' and (ss[i + 2] == 'I'):
				ans2 += 1
		print(ans1)
		print(ans2)
	except EOFError:
		break


try:
	while True:
		A = 0
		B = 0
		a = list(str(input()))
		b = len(a)
		for i in range(b - 2):
			c = a[i] + a[i + 1] + a[i + 2]
			if c == 'JOI':
				A += 1
			if c == 'IOI':
				B += 1
		print(A)
		print(B)
except EOFError:
	pass


while 1:
	try:
		A = input()
		a = len(A)
		C = 'JOI'
		D = 'IOI'
		c = len(C)
		d = len(D)
		s = 0
		for i in range(a - c + 1):
			if C == A[i:i + c]:
				s += 1
		print(s)
		t = 0
		for i in range(a - d + 1):
			if D == A[i:i + d]:
				t += 1
		print(t)
	except EOFError:
		break


while True:
	try:
		m = input()
		print(m.count('JOI'))
		print(m.count('IOI') + m.count('IOIOI'))
	except:
		break


import sys

def input_data():
	a = []
	for line in sys.stdin:
		a.append(str(line))
	return a

def how_in(string, pattern):
	match_num = 0
	for i in range(len(string) - 2):
		if pattern == string[i:i + 3]:
			match_num += 1
	return match_num
yeah = input_data()
for pattern in yeah:
	print(how_in(pattern, 'JOI'))
	print(how_in(pattern, 'IOI'))


while True:
	try:
		n = input()
		J = 0
		I = 0
		for i in range(len(n) - 2):
			if n[i:i + 3] == 'JOI':
				J += 1
			elif n[i:i + 3] == 'IOI':
				I += 1
		print(J)
		print(I)
	except:
		break


while True:
	try:
		tmp = input()
	except:
		break
	(joi, ioi) = (0, 0)
	for i in range(len(tmp)):
		if tmp[i:i + 3] == 'JOI':
			joi += 1
		elif tmp[i:i + 3] == 'IOI':
			ioi += 1
	print(joi, ioi, sep='\n')


while True:
	try:
		n = input()
	except:
		break
	c = [n[i:i + 3] for i in range(len(n) - 2)]
	print(*[c.count(a) for a in ['JOI', 'IOI']], sep='\n')


while True:
	try:
		str = list(input())
		state = 0
		joi = 0
		ioi = 0
		for chara in str:
			if state == 0:
				if chara == 'J':
					state = 1
				elif chara == 'I':
					state = 3
				else:
					state = 0
			elif state == 1:
				if chara == 'J':
					state = 1
				elif chara == 'O':
					state = 2
				elif chara == 'I':
					state = 3
				else:
					state = 0
			elif state == 2:
				if chara == 'J':
					state = 1
				elif chara == 'I':
					state = 3
					joi += 1
				else:
					state = 0
			elif state == 3:
				if chara == 'J':
					state = 1
				elif chara == 'O':
					state = 4
				elif chara == 'I':
					state = 3
				else:
					state = 0
			elif state == 4:
				if chara == 'J':
					state = 1
				elif chara == 'I':
					state = 3
					ioi += 1
				else:
					state = 0
		print(joi)
		print(ioi)
	except EOFError:
		break


def JOIOI(l):
	count_j = 0
	count_i = 0
	for i in range(len(l) - 2):
		if l[i] == 'J' and l[i + 1] == 'O' and (l[i + 2] == 'I'):
			count_j += 1
		if l[i] == 'I' and l[i + 1] == 'O' and (l[i + 2] == 'I'):
			count_i += 1
	return (count_j, count_i)
while True:
	try:
		l = input()
	except EOFError:
		break
	(j, i) = JOIOI(l)
	print(j)
	print(i)


while True:
	try:
		n = input()
		a = 0
		b = 0
		for i in range(len(n) - 2):
			if n[i:i + 3] == 'JOI':
				a += 1
			elif n[i:i + 3] == 'IOI':
				b += 1
		print(a)
		print(b)
	except:
		break


while True:
	s = ''
	try:
		s = input()
	except EOFError:
		break
	c_joi = 0
	c_ioi = 0
	for i in range(len(s) - 2):
		if s[i:i + 3] == 'JOI':
			c_joi += 1
		elif s[i:i + 3] == 'IOI':
			c_ioi += 1
	print(c_joi)
	print(c_ioi)


while True:
	try:
		t = str(input())
	except EOFError:
		break
	p = 'JOI'
	for i in range(2):
		if i == 1:
			p = 'IOI'
		a = int(0)
		for i in range(len(t)):
			f = t[i:i + len(p)]
			if f.find(p) != -1:
				a += 1
		print(a)


while True:
	try:
		x = input()
		a = b = 0
		for i in range(len(x) - 2):
			if x[i] == 'J' and x[i + 1] == 'O' and (x[i + 2] == 'I'):
				a += 1
			if x[i] == 'I' and x[i + 1] == 'O' and (x[i + 2] == 'I'):
				b += 1
		print(a)
		print(b)
	except EOFError:
		break


while True:
	try:
		s = input()
	except:
		break
	c = [s[i:i + 3] for i in range(len(s) - 2)]
	print(*[c.count(a) for a in ['JOI', 'IOI']], sep='\n')


while True:
	try:
		a = list(input())
	except:
		break
	joi = 0
	ioi = 0
	for i in range(len(a) - 2):
		if a[i:i + 3] == ['J', 'O', 'I']:
			joi += 1
		elif a[i:i + 3] == ['I', 'O', 'I']:
			ioi += 1
	print(joi)
	print(ioi)


while True:
	try:
		a = input()
		cj = 0
		ci = 0
		for i in range(len(a) - 2):
			if a[i + 1] == 'O' and a[i + 2] == 'I':
				if a[i] == 'J':
					cj += 1
				elif a[i] == 'I':
					ci += 1
		print(cj)
		print(ci)
	except:
		break


import sys
import math
for x in sys.stdin:
	n = len(x)
	J = 0
	I = 0
	for j in range(n - 2):
		if x[j:j + 3] == 'JOI':
			J += 1
		elif x[j:j + 3] == 'IOI':
			I += 1
	print(J)
	print(I)


while True:
	try:
		s = input()
	except:
		break
	joi = 0
	ioi = 0
	for i in range(len(s) - 2):
		x = s[i] + s[i + 1] + s[i + 2]
		if x == 'JOI':
			joi += 1
		if x == 'IOI':
			ioi += 1
	print(joi)
	print(ioi)


def count(text, part):
	return sum((text.startswith(part, i) for i in range(len(text))))
while True:
	try:
		y = str(input())
	except:
		break
	x = count(y, 'JOI')
	z = count(y, 'IOI')
	print(x)
	print(z)


while True:
	try:
		a = input()
		b = 0
		c = 0
		for i in range(len(a) - 2):
			if a[i] == 'J':
				if a[i + 1] == 'O':
					if a[i + 2] == 'I':
						b += 1
			if a[i] == 'I':
				if a[i + 1] == 'O':
					if a[i + 2] == 'I':
						c += 1
		print(b)
		print(c)
	except:
		break


while True:
	try:
		s = list(str(input()))
		j = 0
		i = 0
		for n in range(len(s) - 2):
			if s[n] == 'J' and s[n + 1] == 'O' and (s[n + 2] == 'I'):
				j += 1
			if s[n] == 'I' and s[n + 1] == 'O' and (s[n + 2] == 'I'):
				i += 1
		print(j)
		print(i)
	except:
		break


import sys
for e in sys.stdin:
	data = e.replace('\n', '')
	countJOI = 0
	countIOI = 0
	for i in range(len(data) - 2):
		c = data[i:i + 3]
		if c == 'JOI':
			countJOI += 1
		elif c == 'IOI':
			countIOI += 1
	print(countJOI)
	print(countIOI)


while True:
	try:
		s = input()
		J = 0
		I = 0
		for i in range(len(s) - 2):
			m = s[i] + s[i + 1] + s[i + 2]
			if m == 'JOI':
				J += 1
			elif m == 'IOI':
				I += 1
		print(J)
		print(I)
	except:
		break


def countDuplicate(S, s):
	cnt = 0
	for i in range(0, len(S) - 2):
		if S.startswith(s, i):
			cnt = cnt + 1
	return cnt
while True:
	try:
		S = str(input().strip())
	except:
		break
	print(countDuplicate(S, 'JOI'))
	print(countDuplicate(S, 'IOI'))


while True:
	try:
		s = input()
		joi = 0
		ioi = 0
		for i in range(len(s) - 2):
			if s[i:i + 3] == 'JOI':
				joi += 1
			if s[i:i + 3] == 'IOI':
				ioi += 1
		print(joi)
		print(ioi)
	except EOFError:
		break


while True:
	try:
		s = input()
	except:
		break
	(a, b) = (0, 0)
	for i in range(len(s) - 2):
		if (s[i], s[i + 1], s[i + 2]) == ('J', 'O', 'I'):
			a += 1
		if (s[i], s[i + 1], s[i + 2]) == ('I', 'O', 'I'):
			b += 1
	print(a)
	print(b)


import sys
for e in sys.stdin:
	s = [e[i:i + 3] for i in range(len(e) - 3)]
	print(s.count('JOI'))
	print(s.count('IOI'))


while True:
	try:
		s = input('')
	except:
		break
	n_joi = 0
	n_ioi = 0
	for i in range(len(s[:-2])):
		cut_s = s[i:i + 3]
		if cut_s == 'JOI':
			n_joi += 1
		if cut_s == 'IOI':
			n_ioi += 1
	print(n_joi)
	print(n_ioi)


while True:
	try:
		s = input()
	except:
		break
	j = i = 0
	j = sum((1 for k in range(len(s) - 1) if s[k] == 'J' and s[k + 1] == 'O' and (s[k + 2] == 'I')))
	i = sum((1 for k in range(len(s) - 1) if s[k] == 'I' and s[k + 1] == 'O' and (s[k + 2] == 'I')))
	print('\n'.join(map(str, [j, i])))


while True:
	try:
		s = input()
	except:
		break
	c = [s[i:i + 3] for i in range(len(s) - 2)]
	print(*[c.count(a) for a in ['JOI', 'IOI']], sep='\n')


import sys
for e in sys.stdin:
	s = [e[i:i + 3] for i in range(len(e) - 3)]
	for w in ['JOI', 'IOI']:
		print(s.count(w))


try:
	while True:
		n = input()
		J = 0
		I = 0
		n = list(n)
		for i in range(len(n)):
			m = n[i:i + 3]
			m = ''.join(m)
			if m == 'JOI':
				J += 1
			elif m == 'IOI':
				I += 1
		print(J)
		print(I)
except EOFError:
	pass


while True:
	try:
		li = list(input())
		JOI = 0
		IOI = 0
		for i in range(len(li) - 2):
			if li[i] == 'J' and li[i + 1] == 'O' and (li[i + 2] == 'I'):
				JOI += 1
			if li[i] == 'I' and li[i + 1] == 'O' and (li[i + 2] == 'I'):
				IOI += 1
		print(JOI)
		print(IOI)
	except:
		break


while 1:
	try:
		S = input()
		(JOI, IOI) = (0, 0)
		for i in range(len(S) - 2):
			r = S[i] + S[i + 1] + S[i + 2]
			if r == 'JOI':
				JOI += 1
			elif r == 'IOI':
				IOI += 1
		print(JOI)
		print(IOI)
	except:
		break


while 1:
	try:
		A = input()
	except:
		break
	B = C = 0
	for i in range(len(A) - 2):
		if A[i:i + 3] == 'JOI':
			B += 1
		elif A[i:i + 3] == 'IOI':
			C += 1
	print(B)
	print(C)


while 1:
	try:
		s = list(input())
	except EOFError:
		break
	joi = ['J', 'O', 'I']
	ioi = ['I', 'O', 'I']
	cnt_j = 0
	cnt_i = 0
	for i in range(len(s) - 2):
		if [s[i], s[i + 1], s[i + 2]] == joi:
			cnt_j += 1
		elif [s[i], s[i + 1], s[i + 2]] == ioi:
			cnt_i += 1
	print(cnt_j)
	print(cnt_i)


def aa(s):
	joi = 0
	ioi = 0
	for i in range(len(s) - 2):
		if s[i:i + 3] == 'JOI':
			joi += 1
		if s[i:i + 3] == 'IOI':
			ioi += 1
	print(joi)
	print(ioi)
n = []
while True:
	try:
		n.append(input())
	except EOFError:
		break
for i in n:
	aa(i)


while True:
	try:
		s = str(input())
		JOI = 0
		IOI = 0
		for i in range(len(s) - 2):
			if s[i] == 'J' and s[i + 1] == 'O' and (s[i + 2] == 'I'):
				JOI += 1
			elif s[i] == 'I' and s[i + 1] == 'O' and (s[i + 2] == 'I'):
				IOI += 1
		print(JOI)
		print(IOI)
	except:
		break


import sys
for e in sys.stdin:
	cnt_j = 0
	cnt_i = 0
	for i in range(len(e) - 2):
		if e[i:i + 3] == 'JOI':
			cnt_j += 1
		elif e[i:i + 3] == 'IOI':
			cnt_i += 1
	print(cnt_j)
	print(cnt_i)


while 1:
	try:
		s = input()
	except:
		break
	sz = len(s)
	(joi, ioi) = (0, 0)
	for i in range(sz - 2):
		t = s[i:i + 3]
		if t == 'JOI':
			joi += 1
		elif t == 'IOI':
			ioi += 1
	print(joi)
	print(ioi)


def f(x):
	joi = 0
	ioi = 0
	for i in range(len(x)):
		if x[i:i + 3] == 'JOI':
			joi += 1
		elif x[i:i + 3] == 'IOI':
			ioi += 1
	print(joi)
	print(ioi)
while True:
	try:
		s = input()
		f(s)
	except:
		exit()


while True:
	try:
		s = input()
	except:
		exit()
	a = b = 0
	for i in range(len(s) - 2):
		if s[i] == 'J' and s[i + 1] == 'O' and (s[i + 2] == 'I'):
			a += 1
		elif s[i] == 'I' and s[i + 1] == 'O' and (s[i + 2] == 'I'):
			b += 1
	print(a)
	print(b)


while True:
	try:
		a = input()
	except EOFError:
		break
	b = 0
	c = 0
	for i in range(len(a)):
		if a[i:i + 3] == 'JOI':
			b += 1
		elif a[i:i + 3] == 'IOI':
			c += 1
		else:
			pass
	print(b)
	print(c)


while True:
	try:
		x = input()
		if x == 'EOF':
			break
		else:
			x = x.replace('I', 'II')
			s = x.count('JOI')
			print(s)
			t = x.count('IOI')
			print(t)
	except EOFError:
		break


while True:
	try:
		n = input()
	except:
		break
	c = [n[i:i + 3] for i in range(len(n) - 2)]
	print(c.count('JOI'))
	print(c.count('IOI'))


while True:
	try:
		s = input()
		Jc = 0
		Ic = 0
		for i in range(len(s) - 2):
			if s[i] == 'J' and s[i + 1] == 'O' and (s[i + 2] == 'I'):
				Jc += 1
			if s[i] == 'I' and s[i + 1] == 'O' and (s[i + 2] == 'I'):
				Ic += 1
		print(Jc)
		print(Ic)
	except EOFError:
		break


while True:
	try:
		s = input().strip()
	except:
		break
	i = 0
	(cnt_joi, cnt_ioi) = (0, 0)
	while i < len(s) - 2:
		t = s[i:i + 3]
		if t == 'JOI':
			cnt_joi += 1
			i += 2
		elif t == 'IOI':
			cnt_ioi += 1
			i += 2
		elif t[2] == 'O':
			i += 1
		elif t[2] == 'I' or t[2] == 'J':
			i += 2
		else:
			i += 3
	print(cnt_joi)
	print(cnt_ioi)


while True:
	try:
		a = input()
	except:
		break
	ans1 = 0
	ans2 = 0
	for i in range(len(a) - 2):
		if a[i:i + 3] == 'JOI':
			ans1 += 1
		elif a[i:i + 3] == 'IOI':
			ans2 += 1
	print(ans1)
	print(ans2)


def f(x):
	J = 0
	I = 0
	for i in range(len(x) - 2):
		if x[i:i + 3] == 'JOI':
			J = J + 1
		if x[i:i + 3] == 'IOI':
			I = I + 1
	print(J)
	print(I)
while True:
	try:
		f(input())
	except:
		break


m = str('JOI')
w = str('IOI')
while True:
	x = 0
	y = 0
	try:
		n = str(input())
	except EOFError:
		break
	a = len(n)
	N = list(n)
	for i in range(a - 2):
		C = []
		for j in range(3):
			C.append(N[j])
		B = ''.join(C)
		c = N[0]
		if B == m:
			x = x + 1
		if B == w:
			y = y + 1
		N.remove(c)
		N.append(c)
	print(x)
	print(y)


while 1:
	try:
		a = input()
	except:
		break
	b = 0
	c = 0
	for i in range(len(a) - 2):
		if a[i:i + 3] == 'JOI':
			b += 1
		elif a[i:i + 3] == 'IOI':
			c += 1
		else:
			pass
	print(b)
	print(c)