import sys
import re
input = sys.stdin.read()
st = 0
nest = 0
score = 0
nc = 0
for c in input:
if st == 0 and c == "{":
nest += 1
score += nest
elif st == 0 and c == "}":
nest -= 1
elif st == 0 and c == "<":
st = 1
elif st == 1 and c == ">":
st = 0
elif st == 1 and c == "!":
st = 2
elif st == 1:
nc += 1
elif st == 2:
st = 1
print(nc, score)