Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.

In this problem you should implement the similar functionality.

You are given a string which only consists of:  uppercase and lowercase English letters,  underscore symbols (they are used as separators),  parentheses (both opening and closing). 

It is guaranteed that each opening parenthesis has a succeeding closing parenthesis. Similarly, each closing parentheses has a preceding opening parentheses matching it. For each pair of matching parentheses there are no other parenthesis between them. In other words, each parenthesis in the string belongs to a matching "opening-closing" pair, and such pairs can't be nested.

For example, the following string is valid: "_Hello_Vasya(and_Petya)__bye_(and_OK)".

Word is a maximal sequence of consecutive letters, i.e. such sequence that the first character to the left and the first character to the right of it is an underscore, a parenthesis, or it just does not exist. For example, the string above consists of seven words: "Hello", "Vasya", "and", "Petya", "bye", "and" and "OK". Write a program that finds:  the length of the longest word outside the parentheses (print 0, if there is no word outside the parentheses),  the number of words inside the parentheses (print 0, if there is no word inside the parentheses). 


-----Input-----

The first line of the input contains a single integer n (1 ≤ n ≤ 255) — the length of the given string. The second line contains the string consisting of only lowercase and uppercase English letters, parentheses and underscore symbols. 


-----Output-----

Print two space-separated integers:  the length of the longest word outside the parentheses (print 0, if there is no word outside the parentheses),  the number of words inside the parentheses (print 0, if there is no word inside the parentheses). 


-----Examples-----
Input
37
_Hello_Vasya(and_Petya)__bye_(and_OK)

Output
5 4


Input
37
_a_(_b___c)__de_f(g_)__h__i(j_k_l)m__

Output
2 6


Input
27
(LoooonG)__shOrt__(LoooonG)

Output
5 2


Input
5
(___)

Output
0 0





-----Note-----

In the first sample, the words "Hello", "Vasya" and "bye" are outside any of the parentheses, and the words "and", "Petya", "and" and "OK" are inside. Note, that the word "and" is given twice and you should count it twice in the answer.

Difficulty: EASY

Solutions:
input()
m = n = 0
for (i, z) in enumerate(input().replace(')', '(').split('(')):
	if 1 & i:
		for z in z.split('_'):
			n += '' != z
	else:
		for z in z.split('_'):
			m = max(m, len(z))
print(m, n)


n = int(input())
string = input()
str1 = ''
str2 = ''
index = 0
_cond = 0
for i in range(n):
	if string[i] == '(':
		str1 += string[index:i] + '_'
		index = i + 1
	if string[i] == ')':
		str2 += string[index:i] + '_'
		index = i + 1
	if i == n - 1 and string[i] != ')':
		str1 += string[index:i + 1]
	if i == n - 1 and string[i] == ')':
		str2 += string[index:i + 1]
list1 = str1.split('_')
lens = 0
for item in list1:
	if len(item) > lens:
		lens = len(item)
list2 = str2.split('_')
count = 0
for item in list2:
	if item != '_' and item != '':
		count += 1
print(lens, count)


n = int(input())
s = input()
out = True
ln = 0
ans1 = 0
ans2 = 0
for i in s:
	if i == '_':
		if out:
			ans1 = max(ans1, ln)
		elif ln > 0:
			ans2 += 1
		ln = 0
	elif i in '()':
		if out:
			ans1 = max(ans1, ln)
		elif ln > 0:
			ans2 += 1
		ln = 0
		out = not out
	else:
		ln += 1
if out:
	ans1 = max(ans1, ln)
elif ln > 0:
	ans2 += 1
print(ans1, ans2)


n = input()
n = int(n)
s = input()
s = str(s)
state = 0
c = 0
l = 0
w = 0
for i in s:
	if state == 0:
		if i == '_':
			if c > l:
				l = c
			c = 0
		elif i == '(':
			if c > l:
				l = c
			c = 0
			state = 1
		else:
			c += 1
	elif i == '_':
		if c != 0:
			w += 1
		c = 0
	elif i == ')':
		if c != 0:
			w += 1
		c = 0
		state = 0
	else:
		c += 1
if c > l:
	l = c
print('%d %d' % (l, w))


n = int(input())
s = list(input())
i = 0
s.append('_')
lengm = 0
c = 0
while i < n + 1:
	leng = 0
	if 'A' <= s[i] <= 'Z' or 'a' <= s[i] <= 'z':
		while 'A' <= s[i] <= 'Z' or 'a' <= s[i] <= 'z':
			leng += 1
			i += 1
		lengm = max(lengm, leng)
	if s[i] == '(':
		while s[i] != ')':
			if 'A' <= s[i] <= 'Z' or 'a' <= s[i] <= 'z':
				c += 1
				while 'A' <= s[i] <= 'Z' or 'a' <= s[i] <= 'z':
					i += 1
			else:
				i += 1
	i += 1
print(lengm, c)


n = int(input())
data = list(input())
res1 = 0
res2 = 0
inpair = False
count = 0
for i in range(n):
	if data[i] == '(':
		if count > 0:
			res1 = max(res1, count)
			count = 0
		inpair = True
	elif data[i] == ')':
		if count > 0:
			res2 += 1
			count = 0
		inpair = False
	elif data[i] != '_':
		count += 1
	elif data[i] == '_':
		if inpair:
			if count > 0:
				res2 += 1
		else:
			res1 = max(res1, count)
		count = 0
	if i == n - 1:
		if count > 0:
			res1 = max(res1, count)
print(res1, res2)


n = int(input())
a = [s.split(')')[::-1] for s in input().split('(')]
(x, y) = (0, 0)
for i in range(len(a)):
	if len(a[i]) == 2:
		for s in a[i][1].split('_'):
			if len(s) > 0:
				y += 1
	for s in a[i][0].split('_'):
		x = max(x, len(s))
print(x, y)


n = input()
s = input() + '_'
inbrackets = False
l = 0
c = 0
length = len(s)
cur = 0
for i in range(length):
	if s[i] == '_':
		if not inbrackets:
			l = max(l, cur)
		elif cur > 0:
			c += 1
		cur = 0
	elif s[i] == '(':
		if not inbrackets:
			l = max(l, cur)
		elif cur > 0:
			c += 1
		inbrackets = True
		cur = 0
	elif s[i] == ')':
		if not inbrackets:
			l = max(l, cur)
		elif cur > 0:
			c += 1
		inbrackets = False
		cur = 0
	else:
		cur += 1
print(l, c)


n = int(input())
text = input()[:n]
len_long_word_out = 0
numb_words_in_paren = 0
if '(' in text:
	open_ind = [i for (i, x) in enumerate(text) if x == '(']
	close_ind = [i for (i, x) in enumerate(text) if x == ')']
	for (i, offset) in enumerate(open_ind):
		tmp = text[offset + 1:close_ind[i]]
		numb_words_in_paren += len(list(filter(None, tmp.split('_'))))
	begin = 0
	for (i, offset) in enumerate(open_ind):
		substr = text[begin:offset].split('_')
		for word in filter(None, substr):
			if len(word) > len_long_word_out:
				len_long_word_out = len(word)
		begin = close_ind[i] + 1
	if begin < len(text):
		for word in text[begin:].split('_'):
			if len(word) > len_long_word_out:
				len_long_word_out = len(word)
else:
	words = text.split('_')
	for word in filter(None, words):
		if len(word) > len_long_word_out:
			len_long_word_out = len(word)
print('%d %d' % (len_long_word_out, numb_words_in_paren))


from re import findall, split, sub
string_length = input()
string = input()
(brackets_pattern, sep, replacement, empty_bracket) = ('\\(.*?\\)', '\\_+', '_', '()')
(max_length, number_of_words_in_brackets) = (0, 0)
for bracket in findall(pattern=brackets_pattern, string=string):
	if bracket != empty_bracket:
		for word in split(pattern=sep, string=bracket.lstrip('(').rstrip(')')):
			if word:
				number_of_words_in_brackets += 1
for word in split(pattern=sep, string=sub(pattern=brackets_pattern, string=string, repl=replacement)):
	max_length = max_length if max_length > len(word) else len(word)
print(f'{max_length} {number_of_words_in_brackets}')


n = int(input())
s = input()
ans1 = 0
ans2 = 0
para = False
us = False
c = 0
for i in s:
	if not para:
		if i != '(' and i != '_' and (i != ')'):
			c += 1
		else:
			ans1 = max(ans1, c)
			c = 0
			if i == '(':
				para = True
	elif i != '(' and i != '_' and (i != ')'):
		us = True
	else:
		if us:
			ans2 += 1
			us = False
		if i == ')':
			para = False
ans1 = max(ans1, c)
print(ans1, ans2)


n = int(input())
a = input() + ' '
count = 0
counts = a.count('(')
for x in range(counts):
	try:
		start = a.index('(')
		stop = a.index(')')
		b = a[start:stop + 1].strip('()').split('_')
		for x in b:
			if len(x) > 0:
				count += 1
		a = a[:start] + '_' + a[stop + 1:]
	except:
		pass
a = a.strip('_ ').split('_')
c = [len(x) for x in a]
print(max(c), count)


input('')
s = input('')

def tokenize(s_input):
	s_input = s_input.replace('(', '_').replace(')', '_')
	return [x for x in s_input.split('_') if x != '']
mask = []
inside_brackets = False
for (i, c) in enumerate(s):
	if c == '(':
		inside_brackets = True
	elif c == ')':
		inside_brackets = False
	if inside_brackets:
		mask.append(1)
	else:
		mask.append(0)
s_inside = s_outside = ''
for (i, c) in enumerate(s):
	if mask[i] == True:
		s_inside += c
	else:
		s_outside += c
inside_words = tokenize(s_inside)
outside_words = tokenize(s_outside)
if len(outside_words):
	a1 = max([len(s) for s in outside_words])
else:
	a1 = 0
a2 = len(inside_words)
print('{} {}'.format(a1, a2))


n = int(input())
s = input()
(ans1, ans2) = ([], [])
st = -1
while True:
	st = s.find('(', st + 1)
	if st == -1:
		break
	e = s.find(')', st)
	ans1 += s[st + 1:e].split('_')
	s = s[:st] + '_' + s[e + 1:]
ans2 = s.split('_')
ans1 = len([x for x in ans1 if x != ''])
ans2 = max([len(x) for x in ans2])
print(ans2, ans1)


a = int(input())
s = input()
ans1 = 0
ckob = 0
g = []
count = 0
for i in range(a):
	if s[i] == '_':
		if count > ans1 and (not ckob):
			ans1 = count
		count = 0
		if ckob and d:
			g.append(d)
			d = ''
	elif s[i] == '(':
		if count > ans1 and (not ckob):
			ans1 = count
		count = 0
		ckob = 1
		d = ''
	elif s[i] == ')':
		count = 0
		if ckob and d:
			g.append(d)
			d = ''
		ckob = 0
	else:
		count += 1
		if ckob:
			d += s[i]
if count > ans1:
	ans1 = count
print(ans1, len(g))


n = int(input())
string = input()
condition = False
temp = string
temp = temp.replace('(', '_')
temp = temp.replace(')', '_')
words = temp.split('_')
a = 0
for x in words:
	if x != '':
		a += 1
temp = string
for x in range(n):
	if string[x] == '(':
		y = x
		condition = True
	elif condition and string[x] == ')':
		temp = temp[:y] + '_' * (x - y + 1) + temp[x + 1:]
		condition = False
words = temp.split('_')
b = 0
for x in words:
	if x != '':
		b += 1
print('%d %d' % (max([len(x) for x in words]), a - b))


n = int(input())
s = input().replace('(', ')').split(')')
l = 0
c = 0
for i in s[::2]:
	for j in i.split('_'):
		l = max(l, len(j))
for i in s[1::2]:
	for j in i.split('_'):
		if j:
			c += 1
print(l, c)


n = int(input())
s = input()
flag = 0
count = 0
ans = 0
for c in s:
	if flag == 0:
		if c == '(':
			flag = 1
			ans = max(count, ans)
			count = 0
		elif c == '_':
			ans = max(count, ans)
			count = 0
		else:
			count += 1
	elif c == ')':
		flag = 0
ans = max(count, ans)
print(ans, end=' ')
flag = 0
count = 0
pre_char = False
for c in s:
	if flag == 0:
		if c == '(':
			flag = 1
	elif c == ')':
		flag = 0
		if pre_char == True:
			count += 1
		pre_char = False
	elif c == '_':
		if pre_char == True:
			count += 1
		pre_char = False
	else:
		pre_char = True
print(count)


n = int(input())
s = list(input())
(kil, ma) = (0, 0)
dl = 0
d = 0
for i in range(n):
	if s[i] == '(':
		dl = 0
		d += 1
	elif s[i] == ')':
		if dl:
			kil += 1
		d -= 1
		dl = 0
	elif d == 1:
		if s[i] == '_':
			if dl:
				dl = 0
				kil += 1
		else:
			dl += 1
	elif d == 0:
		if s[i] == '_':
			dl = 0
		else:
			dl += 1
			if dl > ma:
				ma = dl
print(ma, kil)


n = int(input())
A = input().strip()
A = A.strip('_')
A = A.replace('()', '_')
while '__' in A:
	A = A.replace('__', '_')
A = A.split('(')
P = []
NP = []
while '' in A:
	A.remove('')
for i in range(len(A)):
	if ')' in A[i]:
		NP.append(A[i].split(')')[1])
		P.append(A[i].split(')')[0])
	else:
		NP.append(A[i])
while '' in NP:
	NP.remove('')
while '' in P:
	P.remove('')
NPS = []
for i in NP:
	NPS.extend(i.strip('_').split('_'))
ans1 = 0
for i in NPS:
	ans1 = max(ans1, len(i))
PS = []
for i in P:
	PS.extend(i.strip('_').split('_'))
while '' in PS:
	PS.remove('')
ans2 = len(PS)
print('{} {}'.format(ans1, ans2))


n = int(input())
s = input()
max_word = 0
word_len = 0
in_br = 0
bracket = False
last = ''
for i in range(n):
	if s[i] == '_' and last.isalpha():
		if not bracket and max_word < word_len:
			max_word = word_len
		word_len = 0
		if bracket:
			in_br += 1
	elif s[i] == '(':
		if max_word < word_len:
			max_word = word_len
		word_len = 0
		bracket = True
	elif s[i] == ')':
		bracket = False
		if last.isalpha():
			in_br += 1
		word_len = 0
	elif s[i].isalpha():
		word_len += 1
		if not bracket and max_word < word_len:
			max_word = word_len
	last = s[i]
print(max_word, in_br)


import sys
import math
import bisect

def solve(s):
	n = len(s)
	A = []
	B = []
	nest = False
	tmp = []
	for i in range(n):
		if s[i] == '(':
			nest = True
		elif s[i] == ')':
			nest = False
		elif s[i].isalpha():
			tmp.append(s[i])
			if i + 1 == n or s[i + 1].isalpha() == False:
				if nest:
					A.append(''.join(tmp))
				else:
					B.append(''.join(tmp))
				tmp.clear()
	max_val = 0
	for s in B:
		max_val = max(max_val, len(s))
	return (max_val, len(A))

def main():
	n = int(input())
	s = input()
	ans = solve(s)
	print('%d %d' % (ans[0], ans[1]))
main()


n = int(input())
st = input()
i = 0
maxl = 0
numins = 0
ln = 0
while i < n:
	fl = 0
	if st[i] == '(':
		i += 1
		while st[i] != ')':
			if st[i] != '_':
				fl = 1
			else:
				numins += fl
				fl = 0
			i += 1
		numins += fl
		i += 1
		continue
	if st[i] != '_':
		ln += 1
	if st[i] == '_' or i == n - 1 or st[i + 1] == '(':
		if ln > maxl:
			maxl = ln
		ln = 0
	i += 1
print(maxl, numins)


def main():
	input()
	l = [s for p in input().split('(') for s in p.split(')')]
	print(max(map(len, (w for s in l[::2] for w in s.split('_')))), len([w for s in l[1::2] for w in s.split('_') if w]))
main()


x = int(input())
s = input()
count = 0
count1 = []
count2 = []
m = 0
i = 0
while i < len(s):
	if s[i].isalpha():
		j = i
		while s[j] != '_' and s[j] != '(':
			count += 1
			j += 1
			if j >= len(s):
				break
		count1.append(count)
		i = j
		count = 0
	if i < len(s) and s[i] == '(':
		j = i + 1
		while s[j] != ')':
			if s[j].isalpha() and (s[j + 1] == '_' or s[j + 1] == ')'):
				count += 1
				count2.append(count)
			j += 1
		count = 0
		i = j
	i += 1
for c in count1:
	if c > m:
		m = c
print(m, len(count2))


largo = int(input())
oracion = str(input())
contador = 0
verdadero = True
palabraLarga = 0
palabraMAsLarga = 0
dentroParentesis = False
for i in oracion:
	if i == '(':
		dentroParentesis = True
	if i == ')':
		dentroParentesis = False
	if i == '_' or i == '(' or i == ')':
		verdadero = True
		palabraLarga = 0
	if dentroParentesis == False:
		if i != '_' and i != ')':
			palabraLarga += 1
			if palabraLarga > palabraMAsLarga:
				palabraMAsLarga = palabraLarga
	if dentroParentesis == True:
		if verdadero == True:
			if i != '_' and i != '(' and (i != ')'):
				contador += 1
				verdadero = False
contador = str(contador)
palabraMAsLarga = str(palabraMAsLarga)
print(palabraMAsLarga + ' ' + contador)


import re
l = int(input())
s = str(input())
flag = 0
stack = []
outside_words = []
count_inside = 0

def process(flag):
	global stack, count_inside, outside_words
	if flag == 1:
		if len(stack) > 0:
			count_inside += 1
			stack = []
	elif flag == 0:
		outside_words.append(len(stack))
		stack = []

def process_stack(c, flag):
	global stack
	if c != '_':
		stack.append(c)
for i in s:
	if i == '(':
		process(flag)
		flag = 1
	elif i == ')':
		flag = 0
		if len(stack) > 0:
			count_inside += 1
		stack = []
	elif i == '_':
		process(flag)
	else:
		process_stack(i, flag)
process(flag)
print(max(outside_words), count_inside)


a = int(input())
b = input()
c = b
ip = []
op = []
nip = 0
while len(c):
	if c[0] == '_':
		c = c[1:]
	elif c[0] == '(':
		ind = c.find(')')
		ip.append(c[1:ind])
		c = c[ind + 1:]
	else:
		ind1 = c.find('_')
		ind2 = c.find('(')
		if ind1 == -1 and ind2 == -1:
			op.append(len(c))
			c = ''
		else:
			if ind1 == -1:
				ind1 = ind2
			if ind2 == -1:
				ind2 = ind1
			op.append(min(ind1, ind2))
			c = c[min(ind1, ind2):]
if op:
	print(max(op), end=' ')
else:
	print(0, end=' ')
for i in ip:
	x = i.split('_')
	x = list(filter(None, x))
	nip += len(x)
print(nip)


n = int(input())
a = input()
x = []
c = 0
d = 0
e = 0
for i in a:
	if d == 0 and i != '_' and (i != '('):
		c += 1
	elif i == '(':
		d = 1
		x.append(c)
		c = 0
	elif i == ')':
		d = 0
	elif i == '_':
		x.append(c)
		c = 0
x.append(c)
e = 0
f = 0
y = []
for j in a:
	if f == 1 and j != '_' and (j != ')'):
		e += 1
	elif f == 1 and j == '_':
		y.append(e)
		e = 0
	elif j == '(':
		f = 1
	elif j == ')':
		f = 0
		y.append(e)
		e = 0
p = 0
for k in y:
	if k > 0:
		p += 1
print(max(x), p)


def main():
	from sys import stdin, stdout
	i = 0
	for line in stdin.readlines():
		if i == 0:
			n = int(line)
		elif i == 1:
			string = line.rstrip()
		i += 1
	outside_string = ''
	inside_string = ''
	outside = []
	inside = []
	is_outside = True
	for s in string:
		if s == '(':
			is_outside = False
			inside_string += '_'
			continue
		elif s == ')':
			is_outside = True
			outside_string += '_'
			continue
		if is_outside:
			outside_string += s
		else:
			inside_string += s
	outside = outside_string.split('_')
	inside = inside_string.split('_')
	outside = [i for i in outside if i]
	inside = [i for i in inside if i]
	if outside:
		max_outside = max(map(len, outside))
	else:
		max_outside = 0
	stdout.write(str(max_outside) + ' ' + str(len(inside)))
main()


import re

def main():
	n = input()
	s = input()
	k = re.findall('\\((.*?)\\)', s)
	m = re.sub('\\(.*?\\)', '_', s)
	a = list(m.split('_'))
	r1 = 0
	for x in a:
		r1 = max(r1, len(x))
	r2 = 0
	for x in k:
		p = list(x.split('_'))
		for y in p:
			if y != '':
				r2 += 1
	print(r1, r2)
main()


n = int(input())
s = input()
flag = False
maxW = 0
wC = 0
gg = 0
for i in range(n):
	if s[i] == '(':
		flag = True
		maxW = max(gg, maxW)
		gg = 0
	elif s[i] == ')':
		flag = False
		if i > 0 and s[i - 1] != '_' and (s[i - 1] != ')') and (s[i - 1] != '('):
			wC += 1
	elif s[i] == '_':
		if i > 0 and s[i - 1] != '_' and (s[i - 1] != ')') and (s[i - 1] != '('):
			if flag:
				wC += 1
				continue
		maxW = max(gg, maxW)
		gg = 0
	elif not flag:
		gg += 1
maxW = max(gg, maxW)
print(maxW, wC)


n = input()
STR = input()
insc = False
maxl = 0
ksl = 0
curl = 0
for ch in STR:
	if ch in ['(', ')', '_']:
		if insc:
			if curl != 0:
				ksl += 1
		elif curl > maxl:
			maxl = curl
		curl = 0
		if ch == '(':
			insc = True
		if ch == ')':
			insc = False
	else:
		curl += 1
if curl > maxl:
	maxl = curl
print(maxl, ksl)


n = int(input())
s = input() + '_'
max_out = 0
max_in = 0
count = 0
flag = False
for i in range(n + 1):
	t = s[i]
	if s[i] == '(':
		if count > max_out:
			max_out = count
		count = 0
		flag = True
	elif s[i] == ')':
		flag = False
		continue
	if s[i] == '_' and (not flag):
		if count > max_out:
			max_out = count
		count = 0
	elif not flag:
		count += 1
flag = False
for i in range(n):
	t = s[i]
	if s[i] == '(':
		flag = True
	elif s[i] == ')':
		if s[i - 1] not in '(_':
			max_in += 1
		flag = False
	if s[i] in ')_' and flag and (s[i - 1] not in '_()'):
		max_in += 1
print(max_out, max_in)


(_, s, x) = (input(), list(input()), 0)
while '(' in s:
	x += len([i for i in ''.join(s[s.index('(') + 1:s.index(')')]).split('_') if i])
	s[s.index('('):s.index(')') + 1] = '_'
print(max([len(i) if i else 0 for i in ''.join(s).split('_')]), x)


n = int(input())
S = input()
k = 0
d = 0
m = 0
ma = -1000000
for i in range(len(S)):
	if S[i] != '_' and S[i] != '(' and (S[i] != ')') and (d == 0):
		m = m + 1
	elif S[i] == '_' and d == 0 or (S[i] == '(' and d == 0) or (S[i] == ')' and d == 0):
		if ma < m:
			ma = m
		m = 0
	if S[i] != '_' and S[i] != '(' and (S[i] != ')') and (d == 1):
		m = m + 1
	if d == 1:
		if S[i] == '_' or S[i] == '(' or S[i] == ')':
			if m > 0:
				k = k + 1
			m = 0
	if S[i] == ')':
		d = 0
	if S[i] == '(':
		d = 1
if m > ma:
	ma = m
print(ma, k)


n = int(input())
s = '_' + input() + '_'
outer = 0
inner = 0
(oc, ic) = (0, 0)
bc = False
for c in s:
	if c.isalpha():
		if not bc:
			oc += 1
		else:
			ic += 1
	else:
		outer = max(outer, oc)
		if ic:
			inner += 1
		(oc, ic) = (0, 0)
		if c == '(':
			bc = True
		elif c == ')':
			bc = False
print(outer, inner)


input()
s = input()
ans = ['', '']
cur = 0
for c in s:
	if c == '(':
		ans[cur] += '_'
		cur += 1
	elif c == ')':
		ans[cur] += '_'
		cur -= 1
	else:
		ans[cur] += c
for i in range(2):
	ans[i] = ans[i].split('_')
print(max([0] + [len(w) for w in ans[0]]), sum((1 if w else 0 for w in ans[1])))


n = int(input())
s = input()
(ans1, ans2) = ([], [])
st = -1
while True:
	st = s.find('(', st + 1)
	if st == -1:
		break
	e = s.find(')', st)
	ans1 += s[st + 1:e].split('_')
	s = s[:st] + '_' + s[e + 1:]
ans2 = s.split('_')
(r1, r2) = (0, 0)
for i in ans1:
	if i != '':
		r1 += 1
r2 = len(max(ans2, key=len))
print(r2, r1)


n = int(input())
t = input()
d = set({})
in1 = 0
s1 = set({0})
s2 = set({0})
out1 = 0
count = 0
l = []
for i in t:
	if i == '(':
		s2.add(out1)
		out1 = 0
		d.add(i)
	elif '(' in d:
		if ord(i) >= 65 and ord(i) <= 90 or (ord(i) >= 97 and ord(i) <= 122):
			in1 = in1 + 1
		if i == '_' and in1:
			count = count + 1
			in1 = 0
		elif i == '_':
			in1 = 0
		if i == ')' and in1:
			count = count + 1
			l.append(count)
			d.remove('(')
			in1 = 0
		elif i == ')':
			in1 = 0
			d.remove('(')
	elif i == '_':
		s2.add(out1)
		out1 = 0
	elif ord(i) >= 65 and ord(i) <= 90 or (ord(i) >= 97 and ord(i) <= 122):
		out1 = out1 + 1
		s2.add(out1)
print(max(s2), count)


import re
input()
s = input()
re_i = '(\\w+)[^_()]*?(?=\\))'
re_o = '(\\w+)[^_()]*?(?=\\(|$)'
mi = re.findall(re_i, s)
mo = re.findall(re_o, s)
print(max([len(i) for i in '_'.join(mo).split('_')]), len([i for i in '_'.join(mi).split('_') if len(i)]))


import logging
import copy
import sys
import math
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)

def solve(lines):
	wordsSet = set()
	wordMax = 0
	inWords = 0
	inParent = False
	noParent = 0
	inSidx = 0
	sidx = 0
	for (idx, ch) in enumerate(lines):
		if ch == '(':
			if inParent == False:
				inSidx = idx
				for word in lines[sidx:idx].replace('_', ' ').replace('(', ' ').replace(')', ' ').split():
					wordMax = max([wordMax, len(word)])
			inParent = True
			noParent += 1
		elif ch == ')':
			noParent -= 1
			if noParent == 0:
				inParent = False
				sidx = idx
				inWords += len(lines[inSidx:idx].replace('_', ' ').replace('(', ' ').replace(')', ' ').split())
	if inParent == False:
		for word in lines[sidx:].replace('_', ' ').replace('(', ' ').replace(')', ' ').split():
			wordMax = max([wordMax, len(word)])
	print('%d %d' % (wordMax, inWords))

def main():
	firstLine = input()
	solve(input())

def log(*message):
	logging.debug(message)
main()


n = int(input())
s = input()
ans1 = 0
ans2 = 0
num1 = 0
num2 = 0
i = 0
while i < n:
	if s[i] == '(':
		num1 = 0
		j = i + 1
		while s[j] != ')':
			j += 1
		temp = s[i + 1:j]
		t = temp.split('_')
		while '' in t:
			t.remove('')
		ans2 += len(t)
		i = j + 1
	elif s[i] == '_':
		num1 = 0
		i += 1
	else:
		num1 += 1
		ans1 = max(ans1, num1)
		i += 1
print(ans1, ans2)


import math, sys, re, itertools, pprint
(ri, rai) = (lambda : int(input()), lambda : list(map(int, input().split())))
n = ri()
s = input()
out = True
w = 0
(r1, r2) = (0, 0)
for c in s:
	if c in '_()':
		if w > 0 and (not out):
			r2 += 1
		w = 0
	else:
		w += 1
		if out:
			r1 = max(r1, w)
	if c == '(':
		out = False
	if c == ')':
		out = True
print(r1, r2)


from collections import defaultdict
import sys, os, math
n = int(input())
s = input()
flag = False
(ln, cnt) = (0, 0)
(s1, s2) = ('', '')
for i in range(n):
	if s[i] == '(':
		flag = True
		s1 += '_'
		s2 += '_'
	elif s[i] == ')':
		flag = False
		s1 += '_'
		s2 += '_'
	elif flag:
		s1 += s[i]
	else:
		s2 += s[i]
ln = max((len(ss) for ss in s2.split('_')))
for ss in s1.split('_'):
	if ss != '':
		cnt += 1
print(ln, cnt)


ii = lambda : int(input())
si = lambda : input()
n = ii()
s = si().split('(')
o = s[0].split('_')
i = []
for j in s[1:]:
	(a, b) = j.split(')')
	i += a.split('_')
	o += b.split('_')
print(len(max(o, key=len)), len(list(filter(None, i))))


n = int(input())
s = str(input())
(outside, inside) = ('', '')
p = 0
while p < n:
	if s[p] == '(':
		pd = p + 1
		while pd < n:
			if s[pd] == ')':
				pd += 1
				break
			inside += s[pd]
			pd += 1
		p = pd
		inside += '_'
	else:
		outside += s[p]
		p += 1
		if p < n:
			if s[p] == '(' or s[p] == ')':
				outside += '_'
outside = outside.split('_')
inside = inside.split('_')
val = 0
for j in range(len(outside)):
	val = max(val, len(outside[j]))
length = 0
for j in range(len(inside)):
	if len(inside[j]) > 0:
		length += 1
print(val, length)


def get(s):
	n = len(s)
	res = []
	i = 0
	while i < n:
		while i < n and s[i] == '_':
			i += 1
		j = i
		while j < n and s[j] != '_':
			j += 1
		if j != i:
			res.append(j - i)
		i = j
	return res
n = int(input())
s = list(input())
lmax = 0
cnt = 0
i = 0
while i < n:
	j = i
	while j < n and s[j] != '(':
		j += 1
	ss = get(s[i:j])
	for e in ss:
		lmax = max(lmax, e)
	if j < n and s[j] == '(':
		k = j
		while k < n and s[k] != ')':
			k += 1
		ss = get(s[j + 1:k])
		cnt += len(ss)
		j = k + 1
	i = j
print(lmax, cnt)


import re
flag_left = False
max_ = 0
cant = 0
cant_words = 0
n = input()
cad = input()
groups = re.findall('\\(.*?\\)', cad)
for g in groups:
	cant_words += len(re.findall('[a-zA-Z]+', g))
for c in cad:
	if c.isalpha() and (not flag_left):
		cant += 1
	elif not c.isalpha():
		max_ = max(max_, cant)
		cant = 0
		if c == '(':
			flag_left = True
		if c == ')':
			flag_left = False
max_ = max(max_, cant)
print(max_, cant_words)


n = int(input())
s = input()
if '(' not in s:
	l = 0
	s2 = s.split('_')
	for i in s2:
		if len(i) > l:
			l = len(i)
	print(l, end=' ')
	print(0)
else:
	o = []
	c = []
	for i in range(n):
		if s[i] == '(':
			o.append(i)
		elif s[i] == ')':
			c.append(i)
	b = 0
	for i in range(len(o)):
		s1 = s[o[i] + 1:c[i]].split('_')
		for j in s1:
			if len(j) > 0:
				b += 1
	i = 0
	j = 0
	m1 = 0
	while i < n:
		if i > c[len(c) - 1]:
			s2 = s[i:].split('_')
		else:
			s2 = s[i:o[j]].split('_')
		for k in s2:
			if len(k) > m1:
				m1 = len(k)
		if i > c[len(c) - 1]:
			break
		i = c[j] + 1
		j += 1
	print(m1, end=' ')
	print(b)


n = int(input())
s = input()
out = ''
ins = ''
i = 0
while i < n:
	if s[i] == '(':
		i += 1
		ins += '_'
		out += '_'
		while s[i] != ')':
			ins += s[i]
			i += 1
	else:
		out += s[i]
	i += 1
a = out.split('_')
x = 0
for c in a:
	x = max(x, len(c))
y = 0
b = ins.split('_')
for c in b:
	if c != '':
		y += 1
print(x, y)


n = int(input())
s = input()
i = 0
previ = 0
mlen = 0
cnt = 0
while i < n:
	if s[i] == '(':
		mlen = max(mlen, i - previ)
		j = i + 1
		while s[j] != ')':
			j += 1
		sub = list(filter(lambda x: x != '', s[i + 1:j].split('_')))
		cnt += len(sub)
		i = j + 1
		previ = i
		continue
	if s[i] == '_':
		mlen = max(mlen, i - previ)
		previ = i + 1
	elif i == n - 1:
		mlen = max(mlen, i - previ + 1)
	i += 1
print(mlen, cnt)


from math import inf, sqrt, floor, ceil
from collections import Counter, defaultdict, deque
from heapq import heappush as hpush, heappop as hpop, heapify as h
from operator import itemgetter
from itertools import product
from bisect import bisect_left, bisect_right
n = int(input())
s = input()
index = []
stack = []
for i in range(n):
	if s[i] == '(':
		stack.append(i)
	elif s[i] == ')':
		index.append((stack.pop(), i))
if not index:
	ans1 = 0
	for v in s.split('_'):
		ans1 = max(ans1, len(v))
	ans2 = 0
else:
	new_s = ''
	next = index[0][1]
	inside = ''
	for (i, v) in enumerate(index):
		(a, b) = (v[0], v[1])
		inside += '_' + s[a + 1:b]
		if i == 0:
			new_s += '_' + s[:a]
		else:
			new_s += '_' + s[next + 1:a]
			next = b
	new_s += '_' + s[index[-1][1] + 1:]
	ans1 = 0
	for v in new_s.split('_'):
		ans1 = max(ans1, len(v))
	ans2 = 0
	for v in inside.split('_'):
		if v:
			ans2 += 1
print('%d %d' % (ans1, ans2))


(n, s) = (int(input()), input())
(max_len, in_par) = (0, 0)
while s.find('(') != -1:
	(i, j) = (s.find('('), s.find(')'))
	in_par += len([t for t in s[i + 1:j].split('_') if t])
	s = s[:i] + '_' + s[j + 1:]
max_len = max([len(t) for t in s.split('_')])
print(max_len, in_par)


import re
n = int(input())
s = input()
insideBrackets = False
l = 0
w = 0
count = 0
for i in s:
	if i == '_' or i == '(':
		if count > l:
			l = count
		count = 0
	elif insideBrackets == False:
		count += 1
	if i == '(':
		insideBrackets = True
	if i == ')':
		insideBrackets = False
if count > l:
	l = count
x = []
for i in range(n):
	if s[i] == '(':
		j = i + 1
		while True:
			if s[j] == ')':
				x.append('_')
				break
			x.append(s[j])
			j += 1
pattern = '_'
s = ''.join(x)
x = re.split(pattern, s)
x = [i for i in x if i != '']
print('%d %d' % (l, len(x)))


cnt = lambda s, x: s.count(x)
ii = lambda : int(input())
si = lambda : input()
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
dgl = lambda : list(map(int, input()))
n = ii()
s = si()
w = 0
lt = 0
mxw = 0
lt1 = 0
i = 0
while i < n:
	if s[i] == '(':
		mxw = max(mxw, lt1)
		lt1 = 0
		i += 1
		while 1:
			if s[i] == ')':
				w += lt > 0
				lt = 0
				break
			elif s[i] == '_':
				w += lt > 0
				lt = 0
			else:
				lt += 1
			i += 1
	elif s[i] == '_':
		mxw = max(mxw, lt1)
		lt1 = 0
	else:
		lt1 += 1
	i += 1
print(max(mxw, lt1), w + (lt > 0))


n = input()
text = input()
bracket = False
bracket_word_count = 0
max_length = 0
bracket_s = ''
non_bracket_s = ''
for ch in text:
	if bracket:
		if ch == ')':
			bracket = False
			bracket_word_count += sum((1 for s in bracket_s.split('_') if s))
			bracket_s = ''
		else:
			bracket_s += ch
	elif ch == '(':
		bracket = True
		max_length = max(max_length, max((len(s) for s in non_bracket_s.split('_'))))
		non_bracket_s = ''
	else:
		non_bracket_s += ch
max_length = max(max_length, max((len(s) for s in non_bracket_s.split('_'))))
bracket_word_count += sum((1 for s in bracket_s.split('_') if s))
print('{} {}'.format(max_length, bracket_word_count))


n = int(input())
s = str(input())
a = list(s.split('_'))
d = ''
while '' in a:
	a.remove('')
while '_' in a:
	a.remove('_')
for _ in range(len(a)):
	d += a[_]
	d += ','
b = ''
while '(' in d:
	b += d[d.index('('):d.index(')') + 1]
	d = d[:d.index('(')] + ',' + d[d.index(')') + 1:]
d = list(d.split(','))
while '' in d:
	d.remove('')
d = [len(d[_]) for _ in range(len(d))]
if len(d) == 0:
	print(0, end=' ')
else:
	print(max(d), end=' ')
b = list(b.split('('))
c = ''
for _ in range(len(b)):
	if b[_] != '':
		c += b[_]
c = list(c.split(')'))
while '' in c:
	c.remove('')
e = ''
for _ in range(len(c)):
	e += c[_]
	e += ','
e = list(e.split(','))
while '' in e:
	e.remove('')
while ',' in e:
	e.remove(',')
print(len(e))


n = int(input())
s = input()
inp = False
(st, A, B) = (0, 0, 0)
for c in s:
	if c == '_':
		if st:
			if inp:
				B += 1
			else:
				A = max(A, st)
			st = 0
	elif c == '(':
		assert not inp
		if st:
			A = max(A, st)
			st = 0
		inp = True
	elif c == ')':
		assert inp
		if st:
			B += 1
			st = 0
		inp = False
	else:
		st += 1
assert not inp
if st:
	A = max(A, st)
	st = 0
print(A, B)


n = int(input())
s = input() + '_'
b = False
w = 0
countin = 0
m = 0
for i in s:
	if i == '_':
		if b:
			if w != 0:
				countin += 1
		else:
			m = max(m, w)
		w = 0
	elif i == '(':
		b = True
		m = max(m, w)
		w = 0
	elif i == ')':
		b = False
		if w != 0:
			countin += 1
			w = 0
	else:
		w += 1
print(str(m) + ' ' + str(countin))


n = int(input())
s = input()
(a, b) = (0, 0)
par = []
word = []
last = 0
i = 0
while i < n:
	if s[i] != '_':
		j = i
		if s[i] == '(':
			while j < n and s[j] != ')':
				j += 1
			par.append(s[i + 1:j])
		else:
			j = i
			while j < n and s[j] != '(' and (s[j] != '_'):
				j += 1
			word.append(s[i:j])
		i = j
		if i < n and s[i] == ')':
			i += 1
	else:
		i += 1
if word:
	a = max((len(i) for i in word))
for i in par:
	for j in i.split('_'):
		if j:
			b += 1
print(a, b)


n = int(input())
s = input()
l1 = 0
l2 = 0
m = 0
skob = False
slovo = False
for i in s:
	if i != '(' and i != ')' and (i != '_') and (skob == False):
		l1 = l1 + 1
	if i == '_' and skob == False:
		if l1 > l2:
			l2 = l1
		l1 = 0
	if i == '(' and skob == False:
		if l1 > l2:
			l2 = l1
		l1 = 0
		skob = True
	if skob == True:
		if i != '(' and i != ')' and (i != '_'):
			slovo = True
		if slovo == True and i == '_':
			m += 1
			slovo = False
		if slovo == True and i == ')':
			m += 1
			slovo = False
	if i == ')':
		skob = False
if l1 > l2:
	l2 = l1
print(l2, m)


n = int(input())
s = input()
s1 = '_'
while s.find('(') != -1:
	beg = s.find('(')
	end = s.find(')')
	s1 = s1 + s[beg + 1:end] + '_'
	s = s[:beg] + '_' + s[end + 1:]
a = [len(i) for i in s.split('_') if i]
b = [i for i in s1.split('_') if i]
print(max(a) if len(a) > 0 else 0, len(b))


import re
length = int(input())
s = input()
no_par = re.findall('([^()]*)(?:\\([^)]*\\))?', s)
no_par = '_'.join(no_par)
no_par = no_par.split('_')
if not no_par:
	no_par = ['']
print(max(map(len, no_par)), end=' ')
with_par = re.findall('\\(([^)]*)\\)', s)
with_par = '_'.join(with_par)
with_par = with_par.split('_')
with_par = filter(lambda x: x, with_par)
print(len(list(with_par)))


nb = int(input())
roo = input()
liste = []
liste2 = []
liste3 = [str(x) for x in roo.split('_')]
liste8 = []
for loop in range(nb):
	if roo[loop] == '(':
		liste.append(loop)
	if roo[loop] == ')':
		liste.append(loop)
roo = [x for x in roo]
o = 0
orr = 0
for i in range(len(liste) // 2):
	roo.insert(liste[o] + orr, '_')
	o += 2
	orr += 1
o = 0
orr = 1
liste = []
for loop in range(nb):
	if roo[loop] == ')':
		liste.append(loop)
for i in range(len(liste)):
	roo.insert(liste[o] + orr, '_')
	o += 1
	orr += 1
roo = ''.join(roo)
liste = []
for loop in range(len(roo)):
	if roo[loop] == '(':
		liste.append(loop)
	if roo[loop] == ')':
		liste.append(loop)
n = 0
for loop in range(len(liste) // 2):
	for i in range(liste[n], liste[n + 1] + 1):
		liste2.append(roo[i])
	n += 2
i = 0
while True:
	try:
		if liste2[i] == ')' and liste2[i + 1] == '(':
			liste2.insert(i + 1, '_')
		i += 1
	except:
		break
mm = ' '.join(liste2)
liste2 = [str(x) for x in mm if x.isalpha() or x == '_']
liste2 = ' '.join(liste2)
liste7 = [str(x) for x in liste2.split('_') if x != ' ' and x != '']
roger = len(liste7)
n = 0
m = 0
try:
	koko = liste[n]
except:
	pass
for i in range(len(liste) // 2):
	for l in range(m, koko):
		liste8.append(roo[l])
	try:
		n += 2
		m = liste[n - 1] + 1
		koko = liste[n]
	except:
		break
try:
	koko = liste[len(liste) - 1]
except:
	koko = -1
for loop in range(koko + 1, len(roo)):
	liste8.append(roo[loop])
liste8 = ''.join(liste8).split('_')
tepu = ' '.join(liste8)
ross = [str(x) for x in tepu.split() if x.isalpha()]
pepe = []
for i in range(len(ross)):
	pepe.append(len(ross[i]))
try:
	roger2 = max(pepe)
except:
	roger2 = 0
print('{} {}'.format(roger2, roger))


n = int(input())
s = input()
p = []
for i in range(n):
	if s[i] == '(' or s[i] == ')':
		p.append(i)
ans2 = c = 0
for i in range(0, len(p), 2):
	c = 0
	for j in range(p[i] + 1, p[i + 1]):
		if s[j] == '_':
			ans2 += c
			c = 0
		else:
			c = 1
	if c == 1:
		ans2 += 1
flag = 0
ans = 0
c = 0
for i in range(n):
	if s[i] != '_' and s[i] != ')' and (s[i] != '(') and (flag == 0):
		c += 1
	else:
		if s[i] == ')':
			flag = 0
		elif s[i] == '(':
			flag = 1
			ans = max(ans, c)
		elif s[i] == '_':
			ans = max(ans, c)
		c = 0
ans = max(ans, c)
print(ans, ans2)


n = int(input())
s = input()
out = []
inn = []
p = ''
for x in s:
	if x == '(':
		out.append(p)
		p = ''
	elif x == ')':
		inn.append(p)
		p = ''
	else:
		p += x
out.append(p)
oouut = []
for x in out:
	for y in x.split('_'):
		if len(y):
			oouut.append(y)
iiinn = []
for x in inn:
	for y in x.split('_'):
		if len(y):
			iiinn.append(y)
max = 0
for k in oouut:
	if len(k) > max:
		max = len(k)
print(max, len(iiinn))


lst = []

def dedistyvna(string):
	try:
		indx = string.index('(')
		indx1 = string.index(')')
		s = string[indx + 1:indx1]
		lst.append(s)
		return dedistyvna(string[indx1 + 1:])
	except ValueError:
		pass
	return lst
lst1 = []
inp1 = input()
inp = input()

def dedistyvna1():
	for x in dedistyvna(inp):
		a = x.split('_')
		for line in a:
			if len(line) > 0:
				lst1.append(line)
	return len(lst1)
lst2 = []

def remove_string(string1):
	try:
		a = string1.index('(')
		b = string1.index(')')
		lst2.append(string1[:a])
		return remove_string(string1[b + 1:])
	except ValueError:
		lst2.append(string1)
	return lst2
lst3 = []

def dedistyvna3():
	for y in remove_string(inp):
		b = y.split('_')
		for line in b:
			if len(line) > 0:
				lst3.append(line)
	return lst3
k1 = 0
if len(dedistyvna3()) == 0:
	k1 = 0
else:
	k1 = max(map(len, dedistyvna3()))
print(str(k1) + ' ' + str(dedistyvna1()))


N = int(input())
S = input()
L = S.split('(')
insides = []
outsides = []
for l in L:
	if ')' in l:
		ind = l.index(')')
		insides.append(l[:ind])
		if ind != len(l) - 1:
			outsides.append(l[ind + 1:])
	else:
		outsides.append(l)
insides_ = []
outsides_ = []
for l in insides:
	M = l.split('_')
	for m in M:
		if m != '':
			insides_.append(m)
for l in outsides:
	M = l.split('_')
	for m in M:
		if m != '':
			outsides_.append(m)
if len(outsides_) == 0:
	ans1 = 0
else:
	ans1 = max([len(l) for l in outsides_])
ans2 = len(insides_)
print('{} {}'.format(ans1, ans2))


import sys
import bisect

def takeSecond(elem):
	return elem[1]

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def solve(i1, j1):
	cnt3 = 0
	y = ord(s[i1])
	if y >= 65 and y <= 90 or (y >= 97 and y <= 122):
		cnt3 = 1
	for i2 in range(i1, j1):
		if s[i2] == '_' and (s[i2 + 1] != '_' and s[i2 + 1] != ')'):
			cnt3 += 1
	y = ord(s[j1])
	if y >= 65 and y <= 90 or (y >= 97 and y <= 122):
		cnt3 += 1
	return cnt3
t = 1
for _ in range(t):
	n = int(input())
	s = input()
	(ans1, cnt1) = (0, 0)
	ans2 = 0
	ch = 0
	for i in range(n):
		x = ord(s[i])
		if s[i] == '(':
			ch += 1
		if s[i] == ')':
			ch -= 1
		if (x >= 65 and x <= 90 or (x >= 97 and x <= 122)) and ch == 0:
			cnt1 = 1
			for j in range(i + 1, n):
				x = ord(s[j])
				if x >= 65 and x <= 90 or (x >= 97 and x <= 122):
					cnt1 += 1
				else:
					break
			ans1 = max(ans1, cnt1)
	i = 0
	while i < n:
		if s[i] == '(':
			j = i + 1
			while 1:
				x = ord(s[j])
				if s[j] == ')':
					ans2 += solve(i + 1, j)
					break
				j += 1
			i = j
		i += 1
	print(ans1, ans2)


n = int(input())
s = input()
ib = 0
mx = 0
foo = 0
for i in range(n):
	if s[i] == '(':
		k = i
		while s[k] != ')':
			if (s[k] == '(' or s[k] == '_') and (s[k + 1] != ')' and s[k + 1] != '_'):
				ib += 1
			k += 1
for i in range(n):
	if s[i] == '(':
		k = i + 1
		while s[k] != ')':
			k += 1
		s = s.replace(s[i:k + 1], len(s[i:k + 1]) * '_')
s += '_'
for i in range(n + 1):
	if s[i] != '_':
		mx += 1
	else:
		foo = max(mx, foo)
		mx = 0
print(foo, ib)


n = int(input())
raw_text = input()
max_len = 0
tmp_len = 0
num_word_in_brace = 0
insideFlag = False
withinWord = False
symbol = '()_'
for i in range(n):
	if raw_text[i] == '(':
		insideFlag = True
	elif raw_text[i] == ')':
		insideFlag = False
	if insideFlag:
		if raw_text[i - 1] in symbol and raw_text[i] not in symbol:
			num_word_in_brace += 1
	elif raw_text[i] not in symbol:
		tmp_len += 1
	else:
		max_len = max(max_len, tmp_len)
		tmp_len = 0
print(max(max_len, tmp_len), num_word_in_brace)


import re
n = input()
new = input()
out = [len(x) for x in re.sub('\\(.*?\\)', '_', new).split('_')]
sec = ''
for i in re.findall('\\(\\w+\\)?', new):
	for j in i:
		if j == '(' or j == ')':
			sec += '_'
		else:
			sec += j
ans = 0
for i in re.split('_+', sec):
	if i != '':
		ans += 1
if out == []:
	print(0, ans)
else:
	print(max(out), ans)


import re
l = input()
S = input()
a = [word for e in re.split('\\([^()]*\\)', S) for word in re.split('_+', e)]
b = [word for e in re.findall('\\([^()]*\\)', S) for word in re.split('_+', e[1:-1]) if word]
print(str(len(max(a, key=len))) + ' ' + str(len(b)))


def main():
	from sys import stdin, stdout
	n = int(stdin.readline())
	s = stdin.readline()
	bra = []
	line = set()
	w = ''
	braketflag = False
	for i in s:
		if i == '_':
			if w != '':
				if not braketflag:
					line.add(w)
				else:
					bra.append(w)
			w = ''
		elif i == '(':
			braketflag = True
			if w != '':
				line.add(w)
			w = ''
		elif i == ')':
			braketflag = False
			if w != '':
				bra.append(w)
			w = ''
		elif i == '\n':
			if w != '':
				line.add(w)
		else:
			w += i
	maxi = 0
	for i in line:
		maxi = max(maxi, len(i))
	stdout.write(str(maxi) + ' ' + str(len(bra)))
main()


import sys
input = sys.stdin.readline

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
n = int(input())
string = input().strip()
pars = []
x = ''
f = 0
outside = ''
for i in string:
	if f == 0:
		if i == '(':
			f = 1
			outside += '_'
		else:
			outside += i
	elif i == ')':
		f = 0
		if x != '':
			pars.append(x)
		x = ''
	elif i == '_':
		if x != '':
			pars.append(x)
			x = ''
	else:
		x += i
b = len(pars)
outside = outside.replace('_', ' ').split()
if len(outside) > 0:
	a = max([len(i) for i in outside])
else:
	a = 0
print(*(a, b))


n = int(input())
s = input()
(i, wib, long) = (0, 0, 0)
f = 'OUT'
(x, y) = (0, 0)
while i < n:
	if s[i] == '(':
		f = 'IN'
		i += 1
		continue
	elif s[i] == ')':
		f = 'OUT'
		i += 1
		x = 0
		continue
	elif f == 'OUT':
		if s[i] == '_':
			x = 0
		else:
			x += 1
			if x > long:
				long = x
	elif f == 'IN':
		if s[i] != '_' and (s[i - 1] == '_' or s[i - 1] == '('):
			wib += 1
	i += 1
print(long, end=' ')
print(wib)


input()
s = input()
max_len_outside = 0
inside_count = 0
inside_braces = False
current_len = 0
for i in range(len(s)):
	if s[i] == '_':
		if not inside_braces:
			max_len_outside = max(max_len_outside, current_len)
		else:
			inside_count += 1 if current_len > 0 else 0
		current_len = 0
	elif s[i] == '(':
		inside_braces = True
		max_len_outside = max(max_len_outside, current_len)
		current_len = 0
	elif s[i] == ')':
		inside_braces = False
		inside_count += 1 if current_len > 0 else 0
		current_len = 0
	else:
		current_len += 1
if not inside_braces:
	max_len_outside = max(max_len_outside, current_len)
else:
	inside_count += 1 if current_len > 0 else 0
print(max_len_outside, inside_count)


n = int(input())
s = str(input())
s = s.replace('(', ' ( ')
s = s.replace(')', ' ) ')
s = s.replace('_', ' ')
answer = s.split()
a = 0
b = 0
op = False
for element in answer:
	if element == '(':
		op = True
	elif element == ')':
		op = False
	elif op:
		b += 1
	else:
		a = max(len(element), a)
print(a, b)


import itertools

def string___ins__outs(string):
	string = string
	splted_by_op = string.split('(')
	ins = [x.split(')')[0] for x in splted_by_op if ')' in x]
	outs = [x.split(')')[-1] for x in splted_by_op]
	return (ins, outs)

def outs___max_len(outs):
	lens = [len(x) for x in insouts___words(outs)]
	return max(lens, default=0)

def ins___nr(ins):
	return len(insouts___words(ins))

def insouts___words(inouts):
	words = list(itertools.chain(*(x.split('_') for x in inouts)))
	words = [x for x in words if x != '']
	return words
string_len = int(input())
string = input()
(ins, outs) = string___ins__outs(string)
print(outs___max_len(outs), ins___nr(ins))


from sys import stdin, stdout
n = int(stdin.readline())
s = stdin.readline().strip()
ans = [0, 0]
label = 0
cnt = 0
for i in range(len(s)):
	if s[i] == '(':
		ans[0] = max(ans[0], cnt)
		label = 1
		cnt = 0
	elif s[i] == ')':
		if cnt:
			ans[1] += 1
		label = 0
		cnt = 0
	elif s[i] == '_':
		if label and cnt:
			ans[1] += 1
		else:
			ans[0] = max(ans[0], cnt)
		cnt = 0
	else:
		cnt += 1
if cnt:
	ans[0] = max(ans[0], cnt)
stdout.write(' '.join(list(map(str, ans))))


import re

def count_words(s: str, balance: int):
	if balance == 0:
		return 0
	s = list([x for x in s.split('_') if x != ''])
	return len(s)

def get_len(s: str, balance: int):
	if balance == 1:
		return 0
	s = list([x for x in s.split('_') if x != ''])
	if len(s) == 0:
		return 0
	return max(list(map(len, s)))

def main():
	n = int(input())
	text = input()
	balance = 0
	text = re.split('[()]', text)
	q = 0
	l = 0
	for i in text:
		q += count_words(i, balance)
		l = max(l, get_len(i, balance))
		if balance == 0:
			balance += 1
		else:
			balance -= 1
	print(l, q)
main()


n = int(input())
s = input()
f = False
a = b = 0
for chr in s.replace('(', ')').split(')'):
	for i in chr.split('_'):
		if f:
			b += len(i) != 0
		else:
			a = max(a, len(i))
	f = not f
print(a, b)


value = int(input())
string = input()
string = string.lower()
pam = 'abcdefghijklmnopqrstuvwxyz'
outside = []
inside = []
count = 0
wait = 0
for it in string:
	if wait == 0:
		if it == '_':
			outside.append(count)
			count = 0
		elif it == '(':
			outside.append(count)
			count = 0
			wait = 1
		else:
			count += 1
	elif it == ')':
		wait = 0
outside.append(count)
wait = 0
count = 0
sim = 0
for it in string:
	if it == '(':
		wait = 1
	else:
		pass
	if wait == 1:
		if it == '_':
			if count > 0:
				sim += 1
				count = 0
		elif it == ')':
			if count > 0:
				sim += 1
			wait = 0
			count = 0
		elif it == '(':
			pass
		elif it in pam:
			count += 1
		else:
			pass
inside.append(sim)
print(max(outside), *inside)


banyak = int(input(''))
str = input('')
str = str.replace('(', '_(_')
str = str.replace(')', '_)_')
str2 = str.split('_')
dalam = False
max1 = 0
max2 = 0
for i in str2:
	if i != '':
		if i == '(':
			dalam = True
		elif i == ')':
			dalam = False
		elif not dalam:
			if max1 < len(i):
				max1 = len(i)
		elif dalam:
			max2 += 1
print(max1, max2)


N = int(input())
S = input()
while len(S) > 0 and S[0] == '_':
	S = S[1:]
while len(S) > 0 and S[-1] == '_':
	S = S[:-1]
N = len(S)
D = []
P = []
t = ''
i = 0
while i < N:
	if S[i] == '(':
		D.append(t)
		t = ''
		i += 1
		while i < N and S[i] != ')':
			t += S[i]
			i += 1
		P.append(t)
		t = ''
		i += 1
	else:
		t += S[i]
		i += 1
if len(t) > 0:
	D.append(t)
(d, p) = (0, 0)
for k in D:
	while len(k) > 0 and k[0] == '_':
		k = k[1:]
	while len(k) > 0 and k[-1] == '_':
		k = k[:-1]
	if len(k) == 0:
		continue
	t = ''
	i = 0
	while i < len(k):
		if k[i] != '_':
			t += k[i]
			i += 1
		else:
			t += '_'
			i += 1
			while i < len(k) and k[i] == '_':
				i += 1
	c = t.split('_')
	for i in c:
		d = max(d, len(i))
for k in P:
	while len(k) > 0 and k[0] == '_':
		k = k[1:]
	while len(k) > 0 and k[-1] == '_':
		k = k[:-1]
	if len(k) == 0:
		continue
	t = ''
	i = 0
	while i < len(k):
		if k[i] != '_':
			t += k[i]
			i += 1
		else:
			t += '_'
			i += 1
			while i < len(k) and k[i] == '_':
				i += 1
	p += len(t.split('_'))
print(d, p)


n = int(input())
s = input()

def f1(last, i):
	global s
	m = 0
	for k in s[last:i].split('_'):
		m = max(len(k), m)
	return m

def f2(last, i):
	global s
	m = 0
	for k in s[last:i].split('_'):
		if k != '':
			m += 1
	return m
a1 = 0
a2 = 0
last = 0
i = 0
while i < n:
	if s[i] == '(':
		a1 = max(f1(last, i), a1)
		last = i + 1
		while s[i] != ')':
			i += 1
		a2 += f2(last, i)
		last = i + 1
	i += 1
a1 = max(f1(last, n), a1)
print(a1, a2)


import re
regex = '\\((\\w+)\\)'
regex2 = '([a-zA-Z]+)'
n = input()
test_str = input()
matches = re.finditer(regex, test_str, re.MULTILINE)
test_str_no_parenthesis = test_str
number_of_words = 0
for (matchNum, match) in enumerate(matches, start=1):
	string = match.group()
	test_str_no_parenthesis = test_str_no_parenthesis.replace(string, '_')
	another_matches = [i for i in re.finditer(regex2, string)]
	number_of_words += len(another_matches)
list_len = [len(i.group()) for i in re.finditer(regex2, test_str_no_parenthesis)]
if len(list_len) > 0:
	print(max(list_len), number_of_words)
else:
	print(0, number_of_words)


def B():
	bra = False
	braWord = False
	nIn = 0
	worOut = [0] * 256
	nOut = 0
	n = int(input())
	str = list(input())
	for i in range(n):
		if not bra:
			if str[i] == '_':
				nOut += 1
			elif str[i] == '(':
				nOut += 1
				bra = True
			else:
				worOut[nOut] += 1
		elif str[i] == '_':
			if braWord:
				nIn += 1
				braWord = False
		elif str[i] == ')':
			if braWord:
				nIn += 1
			braWord = False
			bra = False
		else:
			braWord = True
	print(max(worOut), nIn)
B()


from sys import stdin

def solve(word):
	max_chars = 0
	word_count = 0
	char_count = 0
	inside = False
	for char in word:
		if char in '()_':
			if not inside:
				max_chars = max(max_chars, char_count)
			char_count = 0
		else:
			char_count += 1
			if inside and char_count == 1:
				word_count += 1
		if char in '()':
			inside = not inside
	max_chars = max(max_chars, char_count)
	return (max_chars, word_count)
if True:
	next(stdin)
	print(' '.join(map(str, solve(next(stdin).strip('\r\n')))))
else:
	tests = ['_Hello_Vasya(and_Petya)__bye_(and_OK)', '_a_(_b___c)__de_f(g_)__h__i(j_k_l)m__', '(LoooonG)__shOrt__(LoooonG)', '(___)', 'abcdef', 'abcdefg()ab', 'ab_a']
	for test_word in tests:
		print(' '.join(map(str, solve(test_word))))


input()
a = input().replace('(', ')').split(')')
print(max((len(w) for s in a[::2] for w in s.split('_'))), len([w for s in a[1::2] for w in s.split('_') if w]))


n = int(input())
s = input()
words = 0
best = 0
cur = 0
i = 0
while i < n:
	if s[i] == '(':
		x = i
		while s[i] != ')':
			i += 1
		i += 1
		for word in s[x + 1:i - 1].split('_'):
			if len(word) > 0:
				words += 1
	elif s[i] == '_':
		while s[i] == '_':
			i += 1
			if i >= n:
				break
	else:
		cur = 0
		while i < n and s[i] != '_' and (s[i] != '('):
			cur += 1
			i += 1
		best = max(best, cur)
print(best, words)


n = int(input())
a = list(input())
x = [0]
y = [0]
flag = 0
cnt1 = 0
cnt2 = 0
for i in range(n):
	if ord(a[i]) >= 65 and ord(a[i]) <= 90 or (ord(a[i]) >= 97 and ord(a[i]) <= 122):
		if flag == 0:
			cnt1 += 1
		elif flag == 1:
			cnt2 = 1
	elif a[i] == '(':
		flag = 1
		x.append(cnt1)
		cnt1 = 0
	elif a[i] == ')':
		flag = 0
		y.append(cnt2)
		cnt2 = 0
	else:
		if flag == 0:
			x.append(cnt1)
			cnt1 = 0
		if flag == 1:
			y.append(cnt2)
			cnt2 = 0
x.append(cnt1)
a1 = max(x)
a2 = sum(y)
print(a1, a2)


import re

def main():
	try:
		while True:
			n = int(input())
			s = input()
			max_len = inner_count = 0
			inside = False
			for m in re.finditer('[()]|[A-Za-z]+', s):
				t = m.group()[0]
				if t.isalpha():
					if inside:
						inner_count += 1
					else:
						max_len = max(max_len, len(m.group()))
				else:
					inside = t == '('
			print(max_len, inner_count)
	except EOFError:
		pass
main()


import random
import re
import sys
RE_PARENTHESIS = re.compile('(\\([^)]*\\))')
RE_UNDERSCORE = re.compile('_+')
(n, s) = (input(), input())
(c0, c1) = (0, 0)
for i in RE_PARENTHESIS.split(s):
	if i.startswith('('):
		c1 += len([_ for _ in RE_UNDERSCORE.split(i[1:-1]) if len(_)])
	else:
		c0 = max(max((len(_) for _ in RE_UNDERSCORE.split(i))), c0)
print(c0, c1)


I = input
I()
s = I() + '()'
R = str.replace
a = b = 0
t = -1
for i in filter(lambda x: x, R(R(s, '(', ')'), ')', '_').split('_')):
	t = s.find(i, t + 1)
	if s.find('(', t) < s.find(')', t):
		a = max(a, len(i))
	else:
		b += 1
print(a, b)


n = int(input())
s = input()
in_paren = False
words = 0
mx = 0
j = 0
for i in s:
	if i == '_':
		words += 1 if in_paren and j else 0
		if not in_paren:
			mx = max(mx, j)
		j = 0
	elif i == '(':
		in_paren = True
		mx = max(mx, j)
		j = 0
	elif i == ')':
		words += 1 if in_paren and j else 0
		in_paren = False
		j = 0
	else:
		j += 1
mx = max(mx, j)
print(mx, words)


input()
a = input()
wordScopes = 0
longestWord = 0
inScope = False
canInScope = False
sum = 0
for j in range(len(a)):
	i = a[j]
	if i == '(':
		inScope = True
	if i == ')':
		inScope = False
	if i == '_' or i == '(' or i == ')':
		if sum > longestWord:
			longestWord = sum
		sum = 0
		continue
	if not inScope:
		sum += 1
	if j > 0 and (a[j - 1] == '(' or a[j - 1] == '_'):
		canInScope = True
	else:
		canInScope = False
	if inScope and canInScope:
		wordScopes += 1
print(max(longestWord, sum), wordScopes)


n = input()
s = input()
ss = ''
for x in s:
	if x == '(' or x == ')':
		ss += f'_{x}_'
	else:
		ss += x
s = ss.split('_')
t = []
for i in s:
	if i != '':
		t.append(i)
p = False
mx = 0
c = 0
for i in t:
	if i == '(':
		p = True
		continue
	if i == ')':
		p = False
		continue
	if not p:
		mx = max(mx, len(i))
	if p:
		c += 1
print(mx, c)


n = int(input())
s = input().replace('__', '_').replace('_', ' ')
ans_1 = 0
ans_2 = 0
fl = False
t_1 = 0
t_2 = 0
n = len(s)
for i in range(n):
	if s[i] == '(':
		fl = True
		if i + 1 < n and s[i + 1].isalpha():
			t_2 += 1
		t_1 = 0
	elif s[i] == ')':
		fl = False
		ans_2 = max(t_2, ans_2)
	elif s[i] != ' ':
		if not fl:
			t_1 += 1
		else:
			ans_2 = max(t_2, ans_2)
		ans_1 = max(t_1, ans_1)
	else:
		if fl and i + 1 < n and s[i + 1].isalpha():
			t_2 += 1
			ans_2 = max(ans_2, t_2)
		t_1 = 0
print(ans_1, ans_2)


def analyze(s):
	(m1, m2) = (0, 0)
	(m, l) = (0, 0)
	for i in range(len(s)):
		if ord('A') <= ord(s[i]) <= ord('Z') or ord('a') <= ord(s[i]) <= ord('z'):
			m += 1
			continue
		if l > 0 and m > 0:
			m2 += 1
		if l == 0:
			m1 = max(m1, m)
		if s[i] == '(':
			l += 1
		if s[i] == ')':
			l -= 1
		m = 0
	m1 = max(m1, m)
	return (m1, m2)
n = int(input())
print(*analyze(input()))


from itertools import chain
n = int(input())
s = input()
s = s.split('(')
for i in range(len(s)):
	s[i] = s[i].split(')')
s = list(chain(*s))
outs = []
ins = []
c = 0
for c in range(len(s)):
	if c % 2 == 0:
		outs.append(s[c])
	else:
		ins.append(s[c])
for i in range(len(outs)):
	outs[i] = outs[i].split('_')
for i in range(len(ins)):
	ins[i] = ins[i].split('_')
outs = list(chain(*outs))
ins = list(chain(*ins))
outs = list(filter(lambda a: a != '', outs))
ins = list(filter(lambda a: a != '', ins))
if len(outs) == 0:
	res = 0
else:
	res = len(max(outs, key=len))
print(res, len(ins))


(n, word) = (input(), input())
word = word.replace('(', '|').replace(')', '|').split('|')
flag = word[0] == '('
(a, b) = (0, 0)
for foo in word[[0, 1][flag]::2]:
	a = max(a, *[len(w) for w in foo.split('_')])
for foo in word[[1, 0][flag]::2]:
	b += len([w for w in foo.split('_') if w])
print(a, b)


n = int(input())
(len_out, count_in) = (0, 0)
(balance, cur) = (0, 0)
for c in input():
	if not ('a' <= c <= 'z' or 'A' <= c <= 'Z') and cur:
		if balance:
			count_in += 1
		else:
			len_out = max(len_out, cur)
		cur = 0
	if c == '(':
		balance += 1
	elif c == ')':
		balance -= 1
	elif 'a' <= c <= 'z' or 'A' <= c <= 'Z':
		cur += 1
if cur:
	len_out = max(len_out, cur)
print(len_out, count_in)


import re
n = int(input())
a = input()
i = 0
maxln = 0
s = 0
while i < len(a):
	if a[i] == '(':
		j = 0
		while True:
			if a[i] == ')':
				if j != 0:
					s += 1
					j = 0
				break
			if a[i] == '_' and j != 0:
				s += 1
				j = 0
			elif a[i] == '_' and j == 0 or a[i] == '(':
				pass
			else:
				j += 1
			i += 1
	i += 1
for q in re.findall('[(][A-Za-z_]*[)]', a):
	a = a.replace(q, '_', 1)
a = a.split('_')
for q in a:
	lq = len(q)
	if lq > maxln:
		maxln = lq
print(maxln, s)


n = int(input())
s = input()
(p, w) = (False, False)
(x, y, z) = (0, 0, 0)
for c in s:
	if c == '_':
		w = False
		x = 0
	elif c == '(':
		p = True
		w = False
		x = 0
	elif c == ')':
		p = False
		w = False
		x = 0
	else:
		x += 1
		if not p and x > y:
			y = x
		if p and (not w):
			z += 1
		w = True
print(y, z)


a = [int(i) for i in str(input()).split()]
a = str(input())
a = a.replace('(', ' ( ')
a = a.replace(')', ' ) ')
a = a.replace('_', ' ')
a = a.split()
maxword = 0
wordsin = 0
curthing = 0
for i in a:
	if i == '(':
		curthing += 1
		continue
	if i == ')':
		curthing -= 1
		continue
	if curthing > 0:
		wordsin += 1
	else:
		maxword = max(maxword, len(i))
print('%s %s' % (maxword, wordsin))


input()
i = input()
l1 = []
l2 = []
while len(i.split('(')) > 1:
	l1.append(i.split('(')[0])
	i = '('.join(i.split('(')[1:])
	l2.append(i.split(')')[0])
	i = ')'.join(i.split(')')[1:])
l1.append(i)
l1 = '_'.join(l1).split('_')
l2 = '_'.join(l2).split('_')
for i in range(len(l2) - 1, -1, -1):
	if l2[i] == '':
		l2.pop(i)
print(max(list(map(len, l1 + ['']))), len(l2))


n = int(input())
line = str(input()) + '_'
temp_len = max_len = word_count = 0
f_flag = True
u_flag = False
for it in line:
	if it in ('(', ')', '_'):
		if it == '(':
			f_flag = False
			if u_flag:
				u_flag = False
				max_len = max(max_len, temp_len)
				temp_len = 0
		elif it == ')':
			f_flag = True
			if u_flag:
				word_count += 1
		elif it == '_':
			if u_flag:
				u_flag = False
				if f_flag:
					max_len = max(max_len, temp_len)
					temp_len = 0
				else:
					word_count += 1
	else:
		if not u_flag:
			u_flag = True
		if f_flag:
			temp_len += 1
print(str(max_len) + ' ' + str(word_count))


input()
S = input()
inP = 0
longest = 0
numbIns = 0
curL = 0
for s in S:
	if s == '_':
		if inP == 0:
			longest = max(longest, curL)
		elif curL != 0:
			numbIns += 1
		curL = 0
	elif s == '(':
		longest = max(longest, curL)
		inP ^= 1
		curL = 0
	elif s == ')':
		if curL != 0:
			numbIns += 1
		inP ^= 1
		curL = 0
	else:
		curL += 1
		if inP == 0:
			longest = max(longest, curL)
print(longest, end=' ')
print(numbIns)


from re import split
trash = input()
n = input()
par = ''
while '(' in n:
	par = par + n[n.find('('):n.find(')') + 1]
	n = n[:n.find('(')] + '_' + n[n.find(')') + 1:]
para = split('[\\(\\)_]+', par)
na = split('_+', n)
while '' in para:
	para.remove('')
while '' in na:
	na.remove('')
ou = ''
max = 0
for x in na:
	if max < len(x):
		max = len(x)
ou += str(max) + ' ' + str(len(para))
print(ou)


def main():
	n = int(input())
	text = input()
	outside = ''
	inside = ''
	is_inside = False
	for c in text:
		if c == '(':
			is_inside = True
			outside += '_'
			inside += '_'
			continue
		if is_inside and c != ')':
			inside += c
			continue
		if c == ')':
			inside += '_'
			is_inside = False
			continue
		outside += c
	ans1 = max([len(word) for word in outside.split('_')])
	ans2 = sum((1 for word in inside.split('_') if word != ''))
	print(ans1, ans2)
main()


n = int(input())
x = input()
par = False
l = 0
out = 0
num = 0
found_word = False
for i in range(0, n):
	if x[i] == '_':
		if found_word:
			if par:
				num += 1
			else:
				out = max(out, l)
			(found_word, l) = (False, 0)
	elif x[i] == '(':
		if found_word:
			if par:
				num += 1
			else:
				out = max(out, l)
			(found_word, l) = (False, 0)
		par = True
	elif x[i] == ')':
		if found_word:
			if par:
				num += 1
			else:
				out = max(out, l)
			(found_word, l) = (False, 0)
		par = False
	else:
		found_word = True
		l += 1
if found_word:
	if par:
		num += 1
	else:
		out = max(out, l)
	(found_word, l) = (False, 0)
print(out, num)


input()
s = input().replace('(', '-').replace(')', '-').split('-')
print(len(max('_'.join(s[::2]).split('_'), key=len)), sum((len(word) > 0 for word in '_'.join(s[1::2]).split('_'))))


n = int(input())
s = input() + '_'
last = '_'
counter_len = 0
counter_word = 0
max_len = 0
max_counter = 0
open_c = False
for i in range(len(s)):
	if s[i] == '(':
		if counter_len > max_len:
			max_len = counter_len
		counter_len = 0
		open_c = True
		last = '('
	elif s[i] == ')':
		if last not in {'_', '(', ')'} and open_c:
			counter_word += 1
		open_c = False
		last = ')'
	elif s[i] == '_' and (not open_c):
		if counter_len > max_len:
			max_len = counter_len
		counter_len = 0
		last = '_'
	elif s[i] == '_' and open_c:
		if last not in {'_', '(', ')'}:
			counter_word += 1
		last = '_'
	elif not open_c:
		counter_len += 1
		last = 'a'
	else:
		last = 'a'
print(max_len, counter_word)


n = int(input())
s = input().strip()
lw = 0
lw1 = 0
cw = 0
bf = 0
wf = 0
for i in s:
	if i == '(':
		if lw1 > lw:
			lw = lw1
		lw1 = 0
		bf = 1
		wf = 0
	elif i == ')':
		lw1 = 0
		if wf and bf:
			cw += 1
		bf = 0
		wf = 0
	elif i == '_':
		if lw1 > lw:
			lw = lw1
		lw1 = 0
		if wf and bf:
			cw += 1
		wf = 0
	else:
		if not bf:
			lw1 += 1
		wf = 1
if lw1 > lw:
	lw = lw1
print(lw, cw)


n = int(input())
s = input()
br = False
br_index = -1
words = 0
words_in = 0
for i in range(n):
	if s[i] == '_':
		if i - br_index > 1:
			if not br:
				words = max(words, i - br_index - 1)
			elif br:
				words_in += 1
		br_index = i
	if s[i] == '(':
		if i - br_index > 1:
			words = max(words, i - br_index - 1)
		br_index = i
		br = True
	elif s[i] == ')':
		if i - br_index > 1:
			words_in += 1
		br_index = i
		br = False
if n - br_index > 1:
	words = max(words, n - br_index - 1)
print(words, words_in)


n = int(input())
st = input()
inparens = 0
longest = 0
while st.find('(') != -1:
	left = st.find('(')
	right = st.find(')')
	middle = st[left + 1:right]
	parsed = middle.split('_')
	for word in parsed:
		if word != '':
			inparens += 1
	st = st[0:left] + '_' + st[right + 1:]
parsedtwo = st.split('_')
for word in parsedtwo:
	if len(word) > longest:
		longest = len(word)
print(str(longest) + ' ' + str(inparens))


n = int(input())
s = input() + '_'
parentheses = 0
par_arr = []
max_length = 0
in_vocab = 0
words = []
j = 0
for (i, k) in enumerate(s):
	if k == '_':
		words.append(s[j:i])
		j = i + 1
		par_arr.append(parentheses)
		continue
	elif k == '(':
		words.append(s[j:i])
		j = i + 1
		par_arr.append(parentheses)
		parentheses += 1
		continue
	elif k == ')':
		words.append(s[j:i])
		j = i + 1
		par_arr.append(parentheses)
		parentheses -= 1
		continue
	else:
		pass
words.append(s[j:i])
j = i + 1
par_arr.append(parentheses)
parentheses += 1
for i in range(len(words)):
	if par_arr[i] == 0:
		max_length = max(max_length, len(words[i]))
		continue
	elif len(words[i]) > 0:
		in_vocab += 1
print(max_length, in_vocab)


i = int(input())
l = list(input())
longstnotinpar = 0
wordcount = 0
inparcount = 0
p = 0
for x in l:
	if x == '(':
		p = 1
		if wordcount > longstnotinpar:
			longstnotinpar = wordcount
		wordcount = 0
	elif x == ')':
		p = 0
		if wordcount > 0:
			inparcount += 1
			wordcount = 0
	elif p == 0:
		if x == '_':
			if wordcount > longstnotinpar:
				longstnotinpar = wordcount
			wordcount = 0
		else:
			wordcount += 1
	elif p == 1:
		if x == '_':
			if wordcount > 0:
				inparcount += 1
				wordcount = 0
		else:
			wordcount += 1
if wordcount > longstnotinpar:
	longstnotinpar = wordcount
	wordcount = 0
print(longstnotinpar, inparcount)


input()
st = input()
a = b = 0
flag = False
for sl in st.replace(')', '(').split('('):
	for i in sl.split('_'):
		if flag:
			b += len(i) != 0
		else:
			a = max(a, len(i))
	flag = not flag
print(a, b)


n = int(input())
text = input()
op = 0
word = ''
(ans, tot) = (0, 0)
for l in text:
	if len(word) and op == 0:
		ans = max(ans, len(word))
	if l == '(':
		if len(word) > 0 and op > 0:
			tot += 1
		op += 1
		word = ''
	elif l == ')':
		op -= 1
		if len(word) > 0:
			tot += 1
		word = ''
	elif l == '_':
		if len(word) > 0 and op > 0:
			tot += 1
		word = ''
	else:
		word += l
if len(word) > 0:
	ans = max(ans, len(word))
print(ans, tot)


n = int(input())
s = input()
(count, c2, flag) = (0, 0, 0)
(l, p) = ([], [])
for i in range(len(s)):
	if s[i] == '_' and flag != 1:
		if count != 0:
			l.append(count)
			count = 0
	elif s[i] == '(' or flag == 1:
		flag = 1
		if count != 0:
			l.append(count)
			count = 0
		if s[i] != ')':
			if s[i] != '_' and s[i] != '(':
				c2 += 1
			elif s[i] == '_':
				if c2 != 0:
					p.append(c2)
					c2 = 0
		else:
			if c2 != 0:
				p.append(c2)
				c2 = 0
			flag = 0
	else:
		count += 1
if count != 0:
	l.append(count)
try:
	print(max(l), end=' ')
except:
	print(0, end=' ')
try:
	print(len(p), end=' ')
except:
	print(0, end=' ')


n = int(input())
s = input()
b = 0
d = 0
max_d = 0
m = False
k = 0
for i in range(n):
	if s[i] == '(':
		b += 1
	elif s[i] == ')':
		b -= 1
	if b == 0:
		if s[i] == '_' or s[i] == ')' or s[i] == '(':
			if d > max_d:
				max_d = d
			d = 0
		else:
			d += 1
	elif s[i] == '_' or s[i] == ')' or s[i] == '(':
		m = True
	elif m:
		k += 1
		m = False
if d > max_d:
	max_d = d
print(max_d, k)


n = int(input())
s = input()
s += '_'
skob = 0
cnt = 0
maxL = 0
word = ''
for i in range(len(s)):
	cur = s[i]
	if cur == '_':
		if skob > 0 and len(word) != 0:
			cnt += 1
		elif len(word) != 0:
			if len(word) > maxL:
				maxL = len(word)
		word = ''
	elif cur == '(':
		if skob == 0:
			if len(word) > maxL:
				maxL = len(word)
		else:
			cnt += 1
		skob += 1
		word = ''
	elif cur == ')':
		if s[i - 1] != '_' and s[i - 1] != '(':
			cnt += 1
		word = ''
		skob -= 1
	else:
		word += cur
print(maxL, cnt)


n = int(input())
s = input()
ans1 = ans2 = 0
cur = now = 0
for i in s:
	if i == '(':
		ans1 = max(ans1, cur)
		cur = 0
		now = 1
	elif i == ')':
		if cur:
			ans2 += 1
		cur = 0
		now = 0
	elif i == '_':
		if now == 0:
			ans1 = max(ans1, cur)
		elif cur:
			ans2 += 1
		cur = 0
	else:
		cur += 1
		if now == 0:
			ans1 = max(ans1, cur)
print(ans1, ans2)


input()
X = input()
(Parentheses, Outside, i) = ('', '', 0)
while i < len(X):
	if X[i] == '(':
		(i, Parentheses) = (i + 1, Parentheses + '_')
		while X[i] != ')':
			(Parentheses, i) = (Parentheses + X[i], i + 1)
		Outside += '_'
	else:
		Outside += X[i]
	i += 1
Outside = Outside.split('_')
Parentheses = Parentheses.split('_')
print(len(max(Outside, key=len)), len(Parentheses) - Parentheses.count(''))


n = int(input())
t = input()
word = ''
para = ''
u = []
y = []
o = 0
for i in t:
	if i == '(':
		o = 1
	elif i == ')':
		o = 0
	if o == 1:
		if i != '(':
			para += i
		if len(word) > 0:
			y.append(word.split('_'))
		word = ''
	else:
		if len(para) > 0:
			u.append(para.split('_'))
		para = ''
		if i != ')':
			word += i
if len(word) > 0:
	y.append(word.split('_'))
b = 0
for i in u:
	b += len(i) - i.count('')
a = 0
for j in y:
	for k in j:
		if len(k) > a:
			a = len(k)
print(a, b)


n = int(input())
str = str(input())
inbrackets = False
inword = False
lengths = []
count_in_brackets = 0
l = 0
for i in range(0, n):
	if str[i] == '(':
		inword = False
		inbrackets = True
		lengths.append(l)
		l = 0
		continue
	if str[i] == ')':
		inbrackets = False
		if inword:
			count_in_brackets += 1
			inword = False
		continue
	if str[i] != '_':
		inword = True
	elif inword:
		if inbrackets:
			count_in_brackets += 1
		else:
			lengths.append(l)
		l = 0
		inword = False
		continue
	if inbrackets:
		pass
	elif inword:
		l += 1
if l > 0:
	lengths.append(l)
if len(lengths) > 0:
	print(max(lengths), end=' ')
else:
	print(0, end=' ')
print(count_in_brackets)


input()
t = input()
brackets = 0
while '(' in t:
	(s, e) = (t.index('('), t.index(')'))
	brackets += len([x for x in t[s + 1:e].split('_') if x])
	t = t[:s] + '_' + t[e + 1:]
print(max((len(x) for x in t.split('_'))), brackets)


n = int(input())
s = input()
l = 0
max_l = 0
count = 0
word = False
inside = False
LETTERS = 'qwertyuiopasdfghjklzxcvbnm'

def getSplitWords(s):
	return [x for x in s.split('_') if x]

def getBrackets(s):
	ans = []
	while '(' in s:
		ans.append(s[s.rfind('(') + 1:s.find(')', s.rfind('('))])
		s = s[:s.rfind('(')]
	return ans

def getInsideWords(s):
	a = []
	for each in getBrackets(s):
		a += getSplitWords(each)
	return a

def getOutsideWords(s):
	word = ''
	l = 0
	inside = False
	for each in s:
		if each == '(':
			inside = True
		elif each.lower() in LETTERS and (not inside):
			word += each
		elif each == ')':
			inside = False
			word = ''
		else:
			word = ''
		if len(word) > l:
			l = len(word)
	return l
print(getOutsideWords(s), len(getInsideWords(s)))


n = int(input())
s = input()
outs = list()
inside = list()
cnt = 0
flag = 0
count = 0
flag1 = True
flag2 = False
flag3 = True
flag4 = True
for i in range(len(s)):
	if s[i] == '(':
		flag = 1
	elif flag == 1 and s[i] != '(':
		if 65 <= ord(s[i]) <= 90 or 97 <= ord(s[i]) <= 122:
			count += 1
			flag2 = True
			if i + 1 == len(s):
				flag3 = False
				flag1 = False
			if flag3 and s[i + 1] == '_':
				flag1 = False
		elif s[i] == '_' and flag1 == False:
			inside.append(count)
			count = 0
			flag1 = True
			flag2 = False
		elif s[i] == ')':
			flag = 0
			if flag2:
				inside.append(count)
				count = 0
				flag2 = False
	elif (65 <= ord(s[i]) <= 90 or 97 <= ord(s[i]) <= 122) and flag != 1:
		cnt += 1
		if i + 1 == len(s):
			flag4 = False
			outs.append(cnt)
		if flag4 and (s[i + 1] == '_' or s[i + 1] == '(' or s[i + 1] == ')'):
			outs.append(cnt)
			cnt = 0
if outs == []:
	print(0, len(inside))
else:
	print(max(outs), len(inside))


n = int(input())
s1 = input().rstrip()
s = ')'.join(s1.split('(')).split(')')
fl = 0
ans = 0
k = 0
for i in range(len(s)):
	if i % 2 == 0:
		for j in s[i].split('_'):
			if len(j) > ans:
				ans = len(j)
	else:
		for j in s[i].split('_'):
			if len(j) > 0:
				k += 1
print(ans, k)


n = input()
s = str(input())
maxWordLengthOutOfBrackets = 0
numberWordInBrackets = 0
inBrackets = False
currentWidth = 0
for i in range(len(s)):
	if s[i] == '(':
		inBrackets = True
		currentWidth = 0
		if s[i + 1] != '_' and s[i + 1] != ')':
			numberWordInBrackets += 1
	elif s[i] == ')':
		inBrackets = False
		currentWidth = 0
	elif s[i] == '_':
		currentWidth = 0
		if inBrackets and s[i + 1] != '_' and (s[i + 1] != ')'):
			numberWordInBrackets += 1
	else:
		currentWidth += 1
		if inBrackets == False and currentWidth > maxWordLengthOutOfBrackets:
			maxWordLengthOutOfBrackets = currentWidth
print(maxWordLengthOutOfBrackets, numberWordInBrackets)


n = int(input())
s = input()
l = list(s)
l1 = []
maxt = 0
maxw = 0
flag = False
lm = []
for i in range(len(l)):
	if flag == False and l[i] != '_' and (l[i] != '(') and (l[i] != ')'):
		maxt += 1
		lm.append(l[i])
	if flag == False and l[i] == '_':
		l1.append(maxt)
		maxt = 0
	if l[i] == '(':
		flag = True
		l1.append(maxt)
		maxt = 0
	if l[i] == ')':
		flag = False
l1.append(maxt)
flag2 = False
s1 = ''
c = 0
l2 = []
for i in range(len(l)):
	if l[i] == '(':
		flag = True
	if flag and (l[i] != '(' and l[i] != ')'):
		l2.append(l[i])
	if l[i] == ')':
		flag = False
		l2.append('_')
l3 = ''.join(l2)
l4 = l3.split('_')
cnt = 0
for i in l4:
	if i != '':
		cnt += 1
print(max(l1), cnt)


i = input()
string1 = input()
b = False
q = ''
for u in string1:
	if u == '(' or b == True:
		q += str(u)
		b = True
		if u == ')':
			b = False
str23 = q.replace('(', '_').replace(')', '_')
list33 = str23.split('_')
t = list33.count('')
ans1 = len(list33) - t
f = True
q1 = ''
for u in string1:
	if f == True and u != '(':
		q1 += str(u)
	if u == '(':
		q1 += '_'
		f = False
	if u == ')':
		q1 += '_'
		f = True
list34 = q1.split('_')
ans2 = 0
for a in list34:
	if a != '':
		ans2 = max(ans2, len(a))
print(ans2, end=' ')
print(ans1, end=' ')


l = int(input())
s = input()
left = 0
ans = [0] * 2
current = ''
for i in range(l):
	if s[i] == '_':
		if current != '':
			if left == 0:
				ans[0] = max(ans[0], len(current))
			else:
				ans[1] += 1
		current = ''
		continue
	if s[i] == '(':
		ans[0] = max(ans[0], len(current))
		left += 1
		current = ''
	elif s[i] == ')':
		if current != '':
			ans[1] += 1
		left = 0
		current = ''
	else:
		current += s[i]
if current != '':
	ans[0] = max(ans[0], len(current))
print(ans[0], ans[1])


input()
inp = 0
lst = '*'
siz = 0
long = 0
num = 0
for c in input() + '_':
	if c == '_':
		if lst.isalpha():
			if inp == 1:
				num = num + 1
			else:
				long = max(long, siz)
		siz = 0
	elif c == '(':
		if lst.isalpha():
			if inp == 1:
				num = num + 1
			else:
				long = max(long, siz)
		siz = 0
		inp = 1
	elif c == ')':
		if lst.isalpha():
			if inp == 1:
				num = num + 1
			else:
				long = max(long, siz)
		siz = 0
		inp = 0
	else:
		siz = siz + 1
	lst = c
print(str(long) + ' ' + str(num))


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [Scanner.string() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [Scanner.int() for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def solve():
	N = Scanner.int()
	S = Scanner.string()

	def f(L):
		T = []
		for a in L:
			for c in a.split('_'):
				if c != '':
					T.append(c)
		return T
	A = []
	(p, i) = (0, 0)
	while i < N:
		if S[i] == '(':
			A.append(S[p:i])
		elif S[i] == ')':
			p = i + 1
		i += 1
	if p != i:
		A.append(S[p:i])
	p = 0
	i = 0
	B = []
	while i < N:
		if S[i] == '(':
			p = i + 1
		elif S[i] == ')':
			B.append(S[p:i])
		i += 1
	A = f(A)
	B = f(B)
	a1 = max([len(a) for a in A]) if len(A) > 0 else 0
	print(a1, len(B))

def main():
	solve()
main()


N = int(input())
text = input()
outside = True
res1 = 0
res2 = []
word = ''
for c in text:
	if outside:
		if c == '_':
			res1 = max(res1, len(word))
			word = ''
		elif c == '(':
			outside = False
			res1 = max(res1, len(word))
			word = ''
		elif c == ')':
			pass
		else:
			word += c
	elif c == '_':
		if len(word) > 0:
			res2.append(word)
		word = ''
	elif c == '(':
		pass
	elif c == ')':
		outside = True
		if len(word) > 0:
			res2.append(word)
		word = ''
	else:
		word += c
if outside:
	res1 = max(res1, len(word))
elif len(word) > 0:
	res2.append(word)
print(res1, len(res2))


N = int(input())
s = input()
longest_out = 0
words_inside = 0
is_inside = False
word_len = 0
for i in range(len(s)):
	if s[i] == '(':
		longest_out = max(longest_out, word_len)
		word_len = 0
		is_inside = True
	elif s[i] == ')':
		if word_len > 0:
			word_len = 0
			words_inside += 1
		is_inside = False
	elif s[i] == '_':
		if is_inside:
			if word_len > 0:
				word_len = 0
				words_inside += 1
		else:
			longest_out = max(longest_out, word_len)
			word_len = 0
	else:
		word_len += 1
longest_out = max(longest_out, word_len)
print(longest_out, words_inside)


n = int(input())
words = input()
start = 0
outside = []
inside = []
for (ind, c) in enumerate(words):
	if c == '(':
		outside += words[start:ind].split('_')
		start = ind
	if c == ')':
		inside += words[start + 1:ind].split('_')
		start = ind + 1
outside += words[start:n].split('_')
outside = list(filter(lambda item: len(item), outside)) + ['']
inside = list(filter(lambda item: len(item), inside))
print(len(max(outside, key=lambda item: len(item))), len(inside))


n = int(input())
s = input()
noof = 0
while s.find('__') != -1:
	s = s.replace('__', '_')
while s.find('(') != -1:
	start = s.find('(')
	end = s.find(')')
	l = s[start + 1:end]
	while l[:1] == '_':
		l = l[1:]
	while l[-1:] == '_':
		l = l[:-1]
	if l == '':
		pass
	else:
		noof += l.count('_') + 1
	s = s[:start] + '_' + s[end + 1:]
while s[:1] == '_':
	s = s[1:]
while s[-1:] == '_':
	s = s[:-1]
less = 0
s = s.split('_')
for i in s:
	less = max(less, len(i))
print(less, noof)


n = int(input())
s = input()
wl = 0
max_wl = 0
ignore = False
ignore2 = True
substr = ''
num = 0
for l in s:
	if not ignore:
		if l != '_' and l != '(' and (l != ')'):
			wl += 1
		if l == '_':
			if max_wl < wl:
				max_wl = wl
			wl = 0
		if l == '(':
			if max_wl < wl:
				max_wl = wl
			wl = 0
			ignore = True
	elif l == ')':
		ignore = False
	else:
		pass
	if not ignore2:
		if l != ')':
			substr += l
		else:
			ignore2 = True
			num += len([w for w in substr.split('_') if len(w) > 0])
			substr = ''
	elif l == '(':
		ignore2 = False
	else:
		pass
print(max(max_wl, wl), end=' ')
print(num)


n = int(input())
k = input().strip() + '_'
ans1 = 0
ans2 = 0
cnt1 = 0
cnt2 = 0
_in = 0
p = '_'
for i in k:
	if _in:
		if i == ')':
			_in = 0
		if (i == '_' or i == ')') and (p != '_' and p != '('):
			ans2 += 1
		p = i
	else:
		if i == '(':
			if p != '_' and p != ')':
				ans1 = max(ans1, cnt1)
			cnt1 = 0
			_in = 1
		elif i == '_' and p != '_' and (p != ')'):
			ans1 = max(ans1, cnt1)
			cnt1 = 0
		elif i != '_':
			cnt1 += 1
		p = i
print(ans1, ans2)


n = int(input())
s = input()
isParanthesis = False
out_max = 0
in_max = 0
temp_out_max = 0
for (index, char) in enumerate(s):
	if isParanthesis and char != ')':
		pass
	elif char not in '()_':
		temp_out_max += 1
	elif char == '_':
		out_max = max(out_max, temp_out_max)
		temp_out_max = 0
	elif char == '(':
		isParanthesis = True
		out_max = max(out_max, temp_out_max)
		temp_out_max = 0
		temp_s = s[index + 1:index + s[index:].find(')')]
		for word in temp_s.split('_'):
			if word:
				in_max += 1
	else:
		isParanthesis = False
out_max = max(out_max, temp_out_max)
print(out_max, in_max)


import re
input()
sl = input()
fp = False
wc = 0
ol = []
ml = [0]
while sl.count('('):
	t = sl[sl.index('('):sl.index(')') + 1]
	ol += re.split('[_()]', t)
	sl = sl.replace(t, '_', 1)
for s in sl.split('_'):
	ml.append(len(s))
for o in ol:
	if o != '':
		wc += 1
print(max(ml), wc)


N = int(input())
s = input()
s += '$'
paren = []
i = 0
while i >= 0 and s[i] != '$':
	if s[i] == '(':
		j = i + 1
		bw = ''
		while s[j] != ')':
			bw += s[j]
			j += 1
		paren.append(bw)
		s = s[0:i] + '_' + s[j + 1:]
	i += 1
s = s[:-1]
arr = s.split('_')
m = 0
m2 = 0
for x in arr:
	m = max(m, len(x))
for st in paren:
	arr = st.split('_')
	for x in arr:
		if x:
			m2 += 1
print('{0} {1}'.format(m, m2))


n = int(input())
s = input()
(m1, m2) = (0, 0)
d = []
p = 0
for i in s:
	if i == '_':
		if p > 0:
			d.append(p)
			p = 0
	elif i == '(' or i == ')':
		if p > 0:
			d.append(p)
			p = 0
		d.append(i)
	else:
		p += 1
ch = 'AZERTYUIOPQSDFGHJKLMWXCVBN'
if s[-1].upper() in ch:
	d.append(p)
if d != []:
	if d[0] == '(':
		B = False
	else:
		B = True
for i in d:
	if i == '(':
		B = False
	elif i == ')':
		B = True
	elif B == False and i > 0:
		m1 += 1
	elif B == True and i > m2:
		m2 = i
print(m2, m1)


n = int(input())
s = input()
i_p = False
l = 0
m_l = 0
t_i_p = 0
for c in s:
	if c == '(':
		m_l = max(m_l, l)
		l = 0
		i_p = True
	elif c == ')':
		if l != 0:
			t_i_p += 1
		l = 0
		i_p = False
	elif c == '_':
		if i_p and l != 0:
			t_i_p += 1
		else:
			m_l = max(m_l, l)
		l = 0
	else:
		l += 1
m_l = max(m_l, l)
print('%d %d' % (m_l, t_i_p))


input()
s = input() + '_'
wr = 0
sep = 0
curr = 0
mx = 0
cnt = 0
for el in s:
	if el == '(':
		mx = max(mx, curr)
		wr = 1
		curr = 0
	if el == ')':
		if curr != 0:
			cnt += 1
		curr = 0
		wr = 0
	if el == '_':
		if wr == 0:
			mx = max(mx, curr)
			curr = 0
		else:
			if curr != 0:
				cnt += 1
			curr = 0
	if el != '_' and el != '(' and (el != ')'):
		curr += 1
print(mx, cnt)


n = int(input())
s = input()
k = 0
l = 0
p = 0
x = 0
for i in range(n):
	if p == 0:
		if s[i] == '(':
			p = 2
			k = max(x, k)
			x = 0
			y = 0
		elif s[i] == '_':
			p = 1
			k = max(x, k)
			x = 0
		else:
			x += 1
	elif p == 2:
		if y == 1:
			if s[i] == '_' or s[i] == ')':
				l += 1
				y = 0
		elif s[i] != '_' and s[i] != ')':
			y = 1
		if s[i] == ')':
			p = 0
	elif s[i] != '_' and s[i] != '(':
		p = 0
		x += 1
	elif s[i] == '(':
		p = 2
		y = 0
else:
	k = max(x, k)
print(k, l)


(_, string) = (input(), input().replace('(', ')').split(')'))
(string_out, string_in) = (list(), list())
for i in range(len(string)):
	if i % 2 == 0:
		string_out.extend(string[i].split('_'))
	else:
		string_in.extend(string[i].split('_'))
string_out = [len(i) for i in string_out if len(i) > 0]
string_in = [len(i) for i in string_in if len(i) > 0]
if string_out == []:
	string_out = [0]
if string_in == []:
	string_in = []
print(max(string_out), len(string_in))


n = int(input())
st = input()
n += 1
st += '_'
v_sk = []
bz_sk = []
dd = 0
dd1 = 0
sw = False
ct = 0
long = []
for e in range(n):
	if st[e] == '(':
		bz_sk.append(st[dd1:e])
		dd = e + 1
	elif st[e] == ')':
		v_sk.append(st[dd:e])
		dd1 = e + 1
bz_sk.append(st[dd1:])
for e in v_sk:
	rem = -1
	e += '_'
	for qq in range(len(e)):
		if e[qq] == '_':
			if rem == -1:
				continue
			else:
				ct += 1
				rem = -1
		else:
			rem = qq
for e in bz_sk:
	z = e.split('_')
	for k in z:
		kk = 0
		for ee in k:
			if ee != '_':
				kk += 1
		long.append(kk)
print(max(long), ct)


input()
s = input()
(a, b) = (0, 0)
while s.find('(') >= 0:
	(l, r) = (s.find('('), s.find(')'))
	a = max(a, *map(len, s[:l].split('_')))
	b += sum((1 for t in s[l + 1:r].split('_') if t != ''))
	s = s[r + 1:]
a = max(a, *map(len, s.split('_')))
print(a, b)


n = int(input())
t = input()
t = t.replace('_', ' ')
t = t.replace('(', ' ( ')
t = t.replace(')', ' ) ')
(m, p) = (0, 0)
f = False
for w in t.split():
	if w == '(':
		f = True
	elif w == ')':
		f = False
	elif f == True:
		p += 1
	elif f == False:
		m = max(m, len(w))
print(m, p)


charLength = int(input())
string = input()
out_dict = {'longest_length': 0, 'n_par_words': 0, 'word_length': 0, 'par': False}
for (i, char) in enumerate(string):
	if char != '_' and char != '(' and (char != ')'):
		out_dict['word_length'] += 1
	else:
		if out_dict['word_length'] > 0 and out_dict['word_length'] > out_dict['longest_length'] and (not out_dict['par']):
			out_dict['longest_length'] = out_dict['word_length']
		elif out_dict['word_length'] > 0 and out_dict['par']:
			out_dict['n_par_words'] += 1
		out_dict['word_length'] = 0
	if char == '(':
		out_dict['par'] = True
	elif char == ')':
		out_dict['par'] = False
if out_dict['word_length'] > out_dict['longest_length']:
	out_dict['longest_length'] = out_dict['word_length']
print(out_dict['longest_length'], out_dict['n_par_words'])


n = input()
s = input()
outside = ''
inside = ''
parentheses = False
for c in s:
	if c == '(':
		outside += '_'
		parentheses = True
	elif c == ')':
		inside += '_'
		parentheses = False
	elif parentheses:
		inside += c
	else:
		outside += c
mo = 0
x = 0
for word in outside.split('_'):
	mo = max(mo, len(word))
for word in inside.split('_'):
	if word != '':
		x += 1
print(mo, x)


n = int(input())
s = input()
inside = []
insideIndex = []
outside = []
numInside = 0

def countInside(string):
	words = string.split('_')
	count = 0
	for word in words:
		if len(word) > 0:
			count += 1
	return count
popen = -1
pclose = -1
while True:
	try:
		popen = s.find('(', pclose + 1)
		if popen < 0:
			break
		pclose = s.find(')', popen + 1)
		numInside += countInside(s[popen + 1:pclose])
		insideIndex.append((popen, pclose))
	except:
		break

def check(string):
	words = string.split('_')
	maxLength = 0
	for word in words:
		maxLength = max(maxLength, len(word))
	return maxLength
longestOutside = 0
if len(insideIndex) > 0:
	for i in range(len(insideIndex)):
		if i == 0:
			if insideIndex[0][0] > 0:
				longestOutside = max(longestOutside, check(s[0:insideIndex[0][0]]))
		elif insideIndex[i][0] > insideIndex[i - 1][1]:
			longestOutside = max(longestOutside, check(s[insideIndex[i - 1][1] + 1:insideIndex[i][0]]))
	if insideIndex[len(insideIndex) - 1][1] < len(s):
		longestOutside = max(longestOutside, check(s[insideIndex[len(insideIndex) - 1][1] + 1:len(s)]))
else:
	longestOutside = max(longestOutside, check(s))
print(longestOutside, numInside)


(_, s) = (input(), input())
ins = False
c = im = om = 0
for l in s:
	if l == '(':
		om = max(om, c)
		c = 0
		ins = True
	elif l == ')':
		ins = False
		if c:
			im += 1
			c = 0
	elif l == '_':
		if not ins:
			om = max(om, c)
		elif c:
			im += 1
		c = 0
	else:
		c += 1
om = max(om, c)
print(om, im)


n = int(input())
s = input()
(a, b) = (0, 0)
while s.find('(') != -1:
	(l, r) = (s.find('('), s.find(')'))
	m = max((len(i) for i in s[:l].split('_')))
	a = max(a, m)
	b += sum((1 for t in s[l + 1:r].split('_') if t != ''))
	s = s[r + 1:]
m = max((len(i) for i in s.split('_')))
a = max(a, m)
print(a, b)


n = int(input())
str = input()
str += '_'
word_out = []
word_in = []
inpar = 0
counter = 0
for c in str:
	if c == '(':
		inpar = 1
		if counter > 0:
			word_out.append(counter)
			counter = 0
	elif c == ')':
		inpar = 0
		if counter > 0:
			word_in.append(counter)
			counter = 0
	elif c == '_':
		if inpar == 0 and counter > 0:
			word_out.append(counter)
		elif inpar == 1 and counter > 0:
			word_in.append(counter)
		counter = 0
	else:
		counter += 1
if len(word_out) == 0:
	print('0', end=' ')
else:
	print(int(max(word_out)), end=' ')
print(int(len(word_in)))


n = int(input())
s = input().replace('(', '_(_').replace(')', '_)_')
l = 0
in_bracket = False
count = 0
for w in s.split('_'):
	if w == '':
		continue
	if w == '(':
		in_bracket = True
		continue
	if w == ')':
		in_bracket = False
		continue
	if in_bracket:
		count += 1
	else:
		l = max(l, len(w))
print(l, count)


n = int(input())
a = input()
s = 0
c = 0
mx = 0
c1 = 0
cnt = 0
for i in range(n):
	if a[i] == '(':
		s = 1
	if a[i] == ')':
		s = 0
	if s == 0:
		if a[i] != '_' and a[i] != '(' and (a[i] != ')'):
			c += 1
		else:
			if c >= mx:
				mx = c
			c = 0
		if i == n - 1:
			if c >= mx:
				mx = c
			c = 0
	if s == 1:
		if a[i] != '_' and a[i] != '(' and (a[i] != ')'):
			c1 += 1
			if c1 == 1:
				cnt += 1
		else:
			c1 = 0
print(mx, end=' ')
print(cnt)
exit()


f = lambda s: max(map(len, s.split('_')))
g = lambda s: len([e for e in s.split('_') if e])
n = int(input())
s = input()
i = 0
(a, b) = (0, 0)
while i < n:
	j = i
	while j < n and s[j] != '(':
		j += 1
	a = max(a, f(s[i:j]))
	i = j
	while j < n and s[j] != ')':
		j += 1
	b += g(s[i + 1:j])
	i = j + 1
print(a, b)


import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
n = int(input())
s = input()
bracket = False
bracword = 0
maxword = 0
temp = 0
for i in s:
	if i == '_':
		if not bracket:
			maxword = max(temp, maxword)
			temp = 0
		elif temp > 0:
			bracword += 1
			temp = 0
	elif i == '(':
		bracket = True
		maxword = max(temp, maxword)
		temp = 0
	elif i == ')':
		bracket = False
		if temp > 0:
			bracword += 1
			temp = 0
	else:
		temp += 1
if temp > 0:
	maxword = max(maxword, temp)
print(maxword, bracword)


n = int(input())
s = input()
words = 0
longest = 0
b = False
d = False
count = 0
for i in s:
	if i == '(':
		b = True
		count = 0
	if b:
		if d and (i == '_' or i == ')'):
			words += 1
			d = False
		if i != '_' and i != ')' and (i != '('):
			d = True
	if not b:
		if i != '_' and i != '(' and (i != ')'):
			count += 1
		else:
			count = 0
	if count > longest:
		longest = count
	if i == ')':
		b = False
		count = 0
print(longest, words)


n = int(input())
s = input()
brk_start = False
(word_len, word_cnt, word_max_len) = (0, 0, 0)
for i in s:
	if i == '(':
		word_max_len = max(word_max_len, word_len)
		brk_start = True
		word_len = 0
	elif i == ')':
		if word_len > 0:
			word_cnt += 1
		brk_start = False
		word_len = 0
	elif i == '_':
		if word_len > 0:
			if brk_start:
				word_cnt += 1
			else:
				word_max_len = max(word_max_len, word_len)
			word_len = 0
	else:
		word_len += 1
else:
	word_max_len = max(word_max_len, word_len)
print(word_max_len, word_cnt)


n = int(input())
s = input()
s = s.replace('(', '_(_')
s = s.replace(')', '_)_')
word = s.split('_')
cntI = 0
mx = 0
inside = False
for w in word:
	if w == '':
		continue
	if w == '(':
		inside = True
		continue
	if w == ')':
		inside = False
		continue
	if inside:
		cntI += 1
	else:
		mx = max(mx, len(w))
print(mx, cntI)


n = int(input())
s = input()
swb = ''
opened = 0
sib = ''
for sym in s:
	if sym == '(':
		opened += 1
	if sym == ')':
		opened -= 1
	if opened == 0:
		if sym != '(' and sym != ')':
			swb += sym
		if sym == ')':
			swb += '_'
	if opened > 0:
		if sym != ')' and sym != '(':
			sib += sym
		if sym == '(':
			sib += '_'
t = swb.split('_')
print(max([len(elem) for elem in t]), end=' ')
t = sib.split('_')
t1 = []
for lem in t:
	if lem != '':
		t1.append(lem)
print(len(t1))


n = int(input())
s = list(input())
in_p = 0
while True:
	try:
		tmp = s[s.index('(') + 1:s.index(')')]
		del s[s.index('('):s.index(')')]
		s[s.index(')')] = '_'
		s_tmp = ''.join(tmp).split('_')
		for i in s_tmp:
			if len(i) > 0:
				in_p += 1
	except ValueError:
		break
s = ''.join(s).split('_')
l = 0
for i in s:
	l = max(l, len(i))
print('{0} {1}'.format(l, in_p))


n = input()
s = input() + '_'
l = 0
p = 0
br = False
le = 0
pos = 0
j = 0
for i in s:
	if i in '_()':
		if not br:
			l = max(l, le)
		le = 0
	if i == '(':
		pos = j
		br = True
	if i == ')':
		p += len([i for i in s[pos + 1:j].split('_') if len(i) > 0])
		br = False
	if i not in '_()':
		le += 1
	j += 1
print(l, p)


from sys import stdin, stdout, argv
from collections import defaultdict, Counter
printer = print

def input():
	return stdin.readline().rstrip()
s = input()
s = input().strip('_').rstrip('_').replace('_', ' ').split('(')
maxl = 0
count = 0
for i in s:
	if ')' in i:
		i = i.split(')')
		i[0] = i[0].split()
		i[1] = i[1].split()
		count += len(i[0])
		if len(i[1]) > 0:
			maxl = max(maxl, max((len(k) for k in i[1])))
	else:
		i = i.split()
		if len(i) > 0:
			maxl = max(maxl, max((len(k) for k in i)))
print(maxl, count)


def fn1(s):
	ans = 0
	s = '_' + s + '_'
	un = []
	for i in range(len(s)):
		if s[i] == '_':
			un.append(i)
	for i in range(len(un) - 1):
		if un[i + 1] - un[i] > 1:
			ans += 1
	return ans

def fn2(s):
	ans = -1
	s = '_' + s + '_'
	un = []
	for i in range(len(s)):
		if s[i] == '_':
			un.append(i)
	for i in range(len(un) - 1):
		if un[i + 1] - un[i] - 1 > ans:
			ans = un[i + 1] - un[i] - 1
	return ans
n = int(input())
s = str(input())
ob = []
cb = []
for i in range(n):
	if s[i] == '(':
		ob.append(i)
	elif s[i] == ')':
		cb.append(i)
if len(ob) == 0:
	print(fn2('_' + s + '_'), 0)
else:
	l = []
	s1 = '_'
	for i in range(len(ob)):
		l1 = [x for x in range(ob[i], 1 + cb[i])]
		l += l1
		s1 += '_' + s[1 + ob[i]:cb[i]] + '_'
	s1 += '_'
	s2 = '_'
	un = []
	for i in range(n):
		if s[i] == '(' or s[i] == ')':
			s2 += '_'
		elif i not in l:
			s2 += s[i]
	s2 += '_'
	print(fn2(s2), fn1(s1))


n = int(input())
s = input()
ans = []
ans1 = []
f = False
d = ''
for i in range(n):
	if s[i] == '(':
		f = True
		ans.append(d)
		d = ''
	elif s[i] == ')':
		f = False
		ans1.append(d)
		d = ''
	elif not f and s[i] == '_':
		ans.append(d)
		d = ''
	elif f and s[i] == '_':
		ans1.append(d)
		d = ''
	else:
		d += s[i]
if s[i] == '(':
	f = True
	ans.append(d)
	d = ''
elif s[i] == ')':
	f = False
	ans1.append(d)
	d = ''
elif not f and s[i] == '_':
	ans.append(d)
	d = ''
elif f and s[i] == '_':
	ans1.append(d)
	d = ''
elif not f:
	ans.append(d)
m = 0
for elem in ans:
	if elem != '(' and elem != ')':
		m = max(m, len(elem))
a = []
for elem in ans1:
	if len(elem) and elem != '(':
		a.append(elem)
print(m, len(a))


n = int(input())
a = input()
b = ''
for i in range(len(a)):
	if a[i] == '(':
		b = b + '_'
		b = b + '('
	elif a[i] == ')':
		b = b + ')'
		b = b + '_'
	else:
		b = b + a[i]
a = b

def skob(a):
	ind = 0
	l = []
	for i in range(len(a)):
		if a[i] == '(' and ind == 0:
			ind = i
		elif a[i] == ')':
			l = l + [a[ind:i]]
			ind = 0
	return l

def vires(a):
	a = a + '('
	ind = 0
	b = ''
	for i in range(len(a)):
		if a[i] == '(':
			b = b + a[ind:i]
		elif a[i] == ')':
			ind = i + 1
	return b

def slovo(a):
	a = a + '_'
	ind = 0
	pl = []
	l = []
	for i in range(len(a)):
		if a[i] == '_':
			pl = pl + [a[ind:i]]
			ind = i + 1
	for i in range(len(pl)):
		if pl[i] != '' and pl[i] != '_' and (pl[i] != '(') and (pl != ')'):
			l = l + [pl[i]]
	return l

def slovinskob(l):
	pl = []
	a = ''
	fl = False
	for i in range(len(l)):
		if fl == True:
			a = a + '_'
		for j in range(len(l[i])):
			a = a + str(l[i][j])
		fl = True
	return a

def maxsumm(l):
	s = 0
	maxsumm = 0
	ind = 0
	for i in range(len(l)):
		s = len(l[i])
		if s > maxsumm:
			maxsumm = s
	return maxsumm

def vivod(a):
	l2 = skob(a)
	a = vires(a)
	l1 = slovo(a)
	a = slovinskob(l2)
	l2 = slovo(a)
	s = maxsumm(l1)
	return (s, len(l2))
(c, b) = vivod(a)
print(c, b)


n = int(input())
s = input()
in_ = ''
out_ = ''
o = False
for x in s:
	if x == '(':
		o = True
		in_ += '_'
		out_ += '_'
	elif x == ')':
		o = False
		in_ += '_'
		out_ += '_'
	elif o:
		in_ += x
	else:
		out_ += x
a = []
b = []
in_ += '_'
out_ += '_'
s = ''
for x in in_:
	if x == '_':
		if len(s):
			a.append(s)
		s = ''
	else:
		s += x
s = ''
for x in out_:
	if x == '_':
		if len(s):
			b.append(s)
		s = ''
	else:
		s += x
a.sort(key=lambda x: len(x))
b.sort(key=lambda x: len(x))
if len(b) == 0:
	print(0, end=' ')
else:
	print(len(b[-1]), end=' ')
print(len(a))


input()
s = input()
(w, maxp) = (0, 0)
cur = 0
inp = False
for c in s:
	if c.isalpha():
		cur += 1
	elif cur > 0:
		if inp:
			w += 1
		cur = 0
	if c == '(':
		inp = True
	if c == ')':
		inp = False
	if not inp and cur > maxp:
		maxp = cur
print(maxp, w)


n = int(input())
s = input()
sesgsin = []
toksout = []
inparens = []
outparens = []
for (i, c) in enumerate(s):
	if c == '(':
		inparens.append(i)
	elif c == ')':
		outparens.append(i)
numinparen = 0
for (i, o) in zip(inparens, outparens):
	numinparen += sum((1 for t in s[i + 1:o].split('_') if t))
starts = [-1] + outparens
ends = inparens + [len(s)]
maxlen = 0
for (st, e) in zip(starts, ends):
	maxlen = max(maxlen, max((len(t) for t in s[st + 1:e].split('_'))))
print(maxlen, numinparen)


n = int(input())
(out, ins) = (0, 0)
s = input()
p = 0
w = 0
for i in s:
	if p == 0:
		if i == '(':
			p = 1
			out = max(out, w)
			w = 0
		elif i == '_':
			out = max(out, w)
			w = 0
		else:
			w += 1
	elif i == ')':
		p = 0
		if w != 0:
			ins += 1
		w = 0
	elif i == '_':
		if w != 0:
			ins += 1
		w = 0
	else:
		w += 1
if w != 0:
	if p == 0:
		out = max(out, w)
	else:
		ins += 1
print(out, ins)


input()
s = input()
ml = 0
count = 0
wordl = 0
word_co = 0
b = False
word = False
for i in s:
	if b:
		if i != '_' and i != ')' and (not word):
			word = True
			word_co += 1
		elif i == '_':
			word = False
		if i == ')':
			count += word_co
			word_co = 0
			word = False
			b = False
	else:
		if i == '_' or i == '(':
			if wordl > ml:
				ml = wordl
			wordl = 0
		elif i != '_' and i != '(':
			wordl += 1
		if i == '(':
			b = True
if wordl > ml:
	ml = wordl
print('%d %d' % (ml, count))


lens = int(input())
ins = input()
(p, t, c, m) = (0, 0, 0, 0)
for i in range(lens):
	if ins[i] == '_':
		if p and t:
			c += 1
		if not p and t > m:
			m = t
		t = 0
	elif ins[i] == '(':
		p = 1
		if t > m:
			m = t
		t = 0
	elif ins[i] == ')':
		p = 0
		if t:
			c += 1
		t = 0
	else:
		t += 1
if t > m:
	m = t
print(m, c)


(n, s) = (int(input()), input())
(ma, num, flag, flag2, c) = [0 for i in range(5)]
for i in s:
	if i == '(' or i == ')':
		flag = not flag
		flag2 = 0
		c = 0
	elif flag:
		if i == '_':
			flag2 = 0
		elif flag2 == 0:
			num += 1
			flag2 = 1
	elif i == '_':
		c = 0
	else:
		c += 1
		ma = max(c, ma)
print(ma, num)


n = int(input())
s = input()
f = False
lword = 0
wcont = 0
res = 0
for i in range(n):
	if s[i].isalpha() and f == False:
		lword += 1
		if i == n - 1:
			if lword > res:
				res = lword
			lword = 0
	elif s[i] == '_' and f == False:
		if lword > res:
			res = lword
		lword = 0
	elif s[i] == '(':
		f = True
		if lword > res:
			res = lword
		lword = 0
	elif s[i] == ')':
		f = False
	elif f == True:
		if s[i].isalpha() and (s[i + 1] == '_' or s[i + 1] == ')'):
			wcont += 1
print(res, wcont)


n = int(input())
s = input()
strings1 = []
strings2 = []
string = ''
f = False
for letter in s:
	if letter == '_':
		if string and (not f):
			strings1.append(string)
		if f and string:
			strings2.append(string)
		string = ''
	elif letter == '(':
		f = True
		if string:
			strings1.append(string)
		string = ''
	elif letter == ')':
		f = False
		if string:
			strings2.append(string)
		string = ''
	else:
		string += letter
if string:
	strings1.append(string)
try:
	print(len(max(strings1, key=len)), len(strings2))
except BaseException:
	print(0, len(strings2))


import sys, math
n = int(input())
s = input()
fl = 1
sk = 0
a = [0, 0]
gg = ['(', '_', ')']
i = 0
while i < n:
	if s[i] not in gg:
		y = 0
		while i < n and s[i] not in gg:
			y += 1
			i += 1
		if sk == 0:
			a[0] = max(a[0], y)
		else:
			a[1] += 1
		if i >= n:
			break
	elif s[i] == '(':
		sk = 1
		i += 1
	elif s[i] == ')':
		sk = 0
		i += 1
	else:
		i += 1
print(*a)


n = int(input())
s = input()
s = s
a = 0
k = 0
b = 0
i = 0
while i < len(s):
	if s[i] == '(':
		a = 0
		while s[i] != ')':
			if s[i] == '_' and s[i - 1] != '(' and (s[i - 1] != '_'):
				b += 1
			i += 1
		if s[i - 1] != '(' and s[i - 1] != '_':
			b += 1
		i += 1
	elif s[i] == '_':
		a = 0
		i += 1
	else:
		a += 1
		if a > k:
			k = a
		i += 1
print(k, b)


n = int(input())
s = input()
s1 = ''
s2 = ''
flag = True
for i in range(n):
	if s[i] == '(':
		flag = False
		s1 += '_'
		continue
	elif s[i] == ')':
		flag = True
		s2 += '_'
		continue
	if not flag:
		s2 += s[i]
	else:
		s1 += s[i]
s1 = s1.split('_')
s2 = s2.split('_')
inPar = 0
for i in range(len(s2)):
	if len(s2[i]) != 0:
		inPar += 1
outPar = 0
for i in range(len(s1)):
	if len(s1[i]) > outPar:
		outPar = len(s1[i])
print(str(outPar) + ' ' + str(inPar))


n = input()
s = input()
op = False
out = 0
max_out = 0
ins = 0
seen = False
for c in s:
	if c == '(':
		op = True
		seen = False
		max_out = max(out, max_out)
		out = 0
	elif c == ')':
		op = False
		if seen:
			ins += 1
		seen = False
	elif c == '_':
		if seen:
			if op:
				ins += 1
			else:
				max_out = max(out, max_out)
				out = 0
		seen = False
	else:
		if not op:
			out += 1
		seen = True
print(max(max_out, out), ins)


def flatt(z):
	return [x for y in z for x in y]
n = int(input())
s = input()
ss = flatt(map(lambda x: x.split(')'), s.split('(')))
s_in = flatt(map(lambda x: x.split('_'), ss[1::2]))
s_out = flatt(map(lambda x: x.split('_'), ss[0::2]))
n1 = max(map(len, s_out))
n2 = sum(map(lambda x: x != '', s_in))
print(n1, end=' ')
print(n2)


n = int(input())
s = input()
s = [i for i in s]
x = []
par = []
for i in range(n):
	if s[i] == '(' or s[i] == ')':
		par.append(i)
for i in range(0, len(par) - 1, 2):
	x.append(''.join(s[par[i] + 1:par[i + 1]]))
	for j in range(par[i], par[i + 1] + 1):
		s[j] = '_'
s = ''.join(s)
s = s.split('_')
x = '_'.join(x)
x = x.split('_')
a = 0
for i in x:
	if i != '':
		a += 1
print(len(max(s, key=len)), a)


import re
a = input()
a = input()
org = a
inclam = re.findall('\\(.*?\\)', a)
for i in inclam:
	a = a.replace(i, '_')
words = a.split('_')
c = max(map(len, words))
count = 0
for i in inclam:
	count += len(list(filter(None, i.replace('(', '_').replace(')', '_').split('_'))))
print(c, count)


import string
n = int(input())
s = input()
s += '_'
s = '_' + s
(ans1, ans2) = (0, 0)
count_br = 0
count_w = 0
for ch in s:
	if ch == '(':
		if count_w != 0:
			if count_br == 0:
				ans1 = max(ans1, count_w)
			else:
				ans2 += 1
		count_w = 0
		count_br += 1
		continue
	if ch == ')':
		if count_w != 0:
			ans2 += 1
		count_w = 0
		count_br -= 1
		continue
	if ch == '_':
		if count_br != 0 and count_w != 0:
			ans2 += 1
		elif count_br == 0 and count_w != 0:
			ans1 = max(ans1, count_w)
		count_w = 0
		continue
	count_w += 1
print(ans1, ans2)


from string import ascii_lowercase
n = int(input())
s = input()
wordsLen = 0
wordsInside = 0
flagInside = False
currWord = ''
for i in range(n):
	if s[i] == '_':
		currWord = ''
		continue
	elif s[i] == '(':
		currWord = ''
		flagInside = True
	elif s[i] == ')':
		currWord = ''
		flagInside = False
	elif s[i].lower() in ascii_lowercase:
		currWord += s[i]
		if i + 1 < n:
			if s[i + 1] == '_' or s[i + 1] == ')' or s[i + 1] == '(':
				if flagInside:
					wordsInside += 1
				else:
					wordsLen = max(wordsLen, len(currWord))
if s[n - 1].lower() in ascii_lowercase:
	wordsLen = max(wordsLen, len(currWord))
print(wordsLen, wordsInside)


import sys
long_word = 0
word_in_parent = 0
line_length = sys.stdin.readline()
line = sys.stdin.readline()
flags = {'in_parent': 0, 'word_len': 0}
for char in line:
	if char == '_' or char == '(' or char == ')' or (char == '\n'):
		if flags['in_parent'] == 0 and flags['word_len'] > long_word:
			long_word = flags['word_len']
		if flags['in_parent'] > 0 and flags['word_len'] > 0:
			word_in_parent += 1
		if char == '(':
			flags['in_parent'] += 1
		if char == ')':
			flags['in_parent'] -= 1
		flags['word_len'] = 0
	if char.isalpha():
		flags['word_len'] += 1
print('{} {}'.format(long_word, word_in_parent))


import re

def text_parser():
	no_character = int(input())
	text = input()[:no_character]
	l = [x.strip('_') for x in re.findall('_*\\(*_*[A-Za-z]+_*\\)*_*', text)]
	open = False
	max_len = 0
	no_par_words = 0
	for item in l:
		if item[-1] == ')':
			open = False
			no_par_words += 1
			continue
		elif item[0] == '(':
			open = True
		if open == True:
			no_par_words += 1
			continue
		if len(item) > max_len:
			max_len = len(item)
	print(max_len, no_par_words)
text_parser()


length = int(input())
stringArray = str(input())
i = 0
outCount = 0
inCount = 0
maxout = 0
while i < length:
	flag = 0
	outCount = 0
	if stringArray[i] == '_':
		outCount = 0
	elif stringArray[i] == '(':
		outCount = 0
		while stringArray[i] != ')' and i < length:
			i += 1
			if stringArray[i] == '_':
				if stringArray[i - 1] != '_' and stringArray[i - 1] != '(':
					inCount += 1
			elif i < length - 1 and stringArray[i + 1] == ')':
				if stringArray[i] != '_' and stringArray[i] != '(':
					inCount += 1
			else:
				continue
	else:
		while i < length and stringArray[i] != '_':
			if stringArray[i] == '(':
				break
			else:
				outCount += 1
				i += 1
		if outCount > maxout:
			maxout = outCount
		flag = 1
	if flag == 0:
		i += 1
print(maxout, inCount)


n = int(input())
s = input() + '_'
(a, b) = (0, 0)
(l, f) = (0, False)
for c in s:
	if c == '(':
		a = max(a, l)
		(l, f) = (0, True)
	elif c == ')':
		b += 1 if l > 0 else 0
		(l, f) = (0, False)
	elif c == '_':
		if f:
			b += 1 if l > 0 else 0
		else:
			a = max(a, l)
		l = 0
	else:
		l += 1
print(a, b)


length = int(input())
string = input()
outer = ''
inner = ''
i = 0
while i < length:
	if string[i] == '(':
		i += 1
		inner += ' '
		while string[i] != ')':
			if string[i] != '_' and string[i] != '&':
				inner += string[i]
			else:
				inner += ' '
			i += 1
		if string[i] == ')':
			outer += ' '
	elif string[i] != '_' and string[i] != '&':
		outer += string[i]
	else:
		outer += ' '
	i += 1
outer = outer.split()
inner = inner.split()
if outer == []:
	print(0, end=' ')
else:
	len_o = []
	for i in outer:
		len_o.append(len(i))
	print(max(len_o), end=' ')
print(len(inner))


int(input())
s = input()
tmp = False
(IN, out) = (0, 0)
for i in s.replace('(', ')').split(')'):
	for ch in i.split('_'):
		if tmp:
			if ch:
				out += 1
		else:
			IN = max(IN, len(ch))
	tmp = not tmp
print(IN, out)


a = input()
s = list(input())
i = 0
ss = sc = max1 = 0
fal = 0
for i in range(len(s)):
	if s[i] == '_':
		sc = 0
	if s[i] == '(':
		fal += 1
		sc = 0
		if s[i + 1] != ')' and s[i + 1] != '_':
			ss += 1
	if fal == 0 and s[i] != '_' and (s[i] != ')') and (s[i] != '('):
		sc = sc + 1
		if sc > max1:
			max1 = sc
	if s[i] == ')':
		fal -= 1
		sc = 0
	if fal >= 1:
		if s[i] == '_':
			ss += 1
			if s[i + 1] == '_' or s[i + 1] == ')' or s[i - 1] == ')':
				ss -= 1
print(max1, ss)


import re
a = input()
a = input()
org = a
inclam = re.findall('\\(.*?\\)', a)
for i in inclam:
	a = a.replace(i, '_')
words = a.split('_')
c = max(list(map(len, words)))
count = 0
for i in inclam:
	count += len(list([_f for _f in i.replace('(', '_').replace(')', '_').split('_') if _f]))
print(c, count)


n = int(input())
stroka = input()
answer1 = 0
answer2 = 0
k = ''
count = 0
for i in range(0, n):
	if stroka[i] == '_':
		if k != '' and count == 0:
			if len(k) > answer1:
				answer1 = len(k)
		elif k != '' and count == 1:
			answer2 += 1
		k = ''
	elif stroka[i] == '(':
		if k != '':
			if len(k) > answer1:
				answer1 = len(k)
		k = ''
		count = 1
	elif stroka[i] == ')':
		count = 0
		if k != '':
			k = ''
			answer2 += 1
	elif count == 0:
		k += stroka[i]
	else:
		k += stroka[i]
if len(k) > answer1:
	answer1 = len(k)
print(answer1, answer2)


n = int(input())
s = input().split('(')
t = []
for i in range(len(s)):
	t += s[i].split(')')
a = t[1::2]
b = t[::2]
(a1, b1) = (0, 0)
for i in b:
	for j in i.split('_'):
		a1 = max(a1, len(j))
for i in a:
	for j in i.split('_'):
		if j != '':
			b1 += 1
print(a1, b1)


input()
s = input()
outer = []
inner = []
in_bra = False
for c in s:
	if c in ('(', ')'):
		inner.append('_')
		outer.append('_')
		in_bra = c == '('
	else:
		(a, b) = (inner, outer) if in_bra else (outer, inner)
		a.append(c)
		b.append('_')
outer = sorted(''.join(outer).split('_'), key=lambda x: len(x), reverse=True)
inner = [c for c in ''.join(inner).split('_') if c]
print(len(outer[0]), len(inner))


n = int(input())
s = input()
k = 0
m = 0
f = 0
t = 0
for i in range(n):
	if s[i] == '(':
		if k != 0:
			m = max(m, k)
		f = 1
	if s[i] == ')':
		if k != 0:
			t = t + 1
		f = 0
	if s[i] == '_' or s[i] == '(' or s[i] == ')':
		if f == 0 and s[i] != ')':
			m = max(m, k)
		if f == 1 and k != 0 and (s[i] != '('):
			t = t + 1
		k = 0
	else:
		k = k + 1
if f == 0 and s[n - 1] != ')':
	m = max(m, k)
print(m, t)


n = int(input())
s = input()
words_in = []
words_out = ['']
brackets = False
buff = ''
for i in range(len(s)):
	if s[i] in ('(', ')', '_'):
		if buff:
			if brackets:
				words_in.append(buff)
			else:
				words_out.append(buff)
			buff = ''
	if s[i] == '(':
		brackets = True
	elif s[i] == ')':
		brackets = False
	elif s[i] != '_':
		buff += s[i]
if buff:
	if brackets:
		words_in.append(buff)
	else:
		words_out.append(buff)
	buff = ''
print(len(max(words_out, key=lambda x: len(x))), len(words_in))


n = int(input())
s = input()
s = s + '_'
ip = 0
m = 0
flag = 0
a = ''
for i in s:
	if i == '(':
		m = max(m, len(a))
		flag = 1
		a = ''
	elif i.isalpha():
		a += i
	elif i == '_' and a != '' and (flag == 1):
		ip += 1
		a = ''
	elif i == '_' and a != '' and (flag == 0):
		m = max(m, len(a))
		a = ''
	elif i == ')':
		flag = 0
		if a != '':
			ip += 1
			a = ''
print(str(max(m, len(a))) + ' ' + str(ip))


import re
l = int(input())
s = input()
s_clean = re.sub('_+', ' ', s.lower())
s_clean = s_clean.replace('(', ' ( ')
s_clean = s_clean.replace(')', ' ) ')
s_list = s_clean.split()

def find_larget(l):
	largest = 0
	for st in l:
		if len(st) > largest:
			largest = len(st)
	return largest

def main(s, l):
	in_parentheses = False
	in_words = []
	out_words = []
	for word in s:
		if word == '(':
			in_parentheses = True
			continue
		if word == ')':
			in_parentheses = False
			continue
		if in_parentheses:
			in_words.append(word)
		else:
			out_words.append(word)
	largest = find_larget(out_words)
	return (largest, len(in_words))
(var1, var2) = main(s_list, l)
print('%d %d' % (var1, var2))


(n, lop, nip, p, c) = (int(input()), 0, 0, False, 0)
for ch in input() + '_':
	if ch.isalpha():
		c += 1
	elif c:
		if p:
			nip += 1
		elif c > lop:
			lop = c
		c = 0
	if ch in '()':
		p = not p
print(lop, nip)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 10
mod = 10 ** 9 + 7

def f():
	n = int(input())
	s = input()
	f = False
	r = 0
	r2 = 0
	sc = ''
	for c in s:
		if c == '(':
			for ss in sc.split('_'):
				r = max(r, len(ss))
			sc = ''
		elif c == ')':
			r2 += len([_ for _ in sc.split('_') if len(_) > 0])
			sc = ''
		else:
			sc += c
	for ss in sc.split('_'):
		r = max(r, len(ss))
	return '{0} {1}'.format(r, r2)
print(f())


n = input()
string = input()
outside_parens = '_'.join([x.split(')')[-1] for x in string.split('(')])
words = sorted(outside_parens.split('_'), key=len)
longestWord = len(words[-1])
inside_parens = '_'.join([x.split(')')[0] for x in string.split('(')][1:])
word_count = len([x for x in inside_parens.split('_') if x])
print(longestWord, word_count)


import re
n = int(input())
s = str(input())
un = []
br = []
tmp = ''
for i in s:
	if i == '(':
		un.append(tmp)
		tmp = ''
	elif i == ')':
		br.append(tmp)
		tmp = ''
	else:
		tmp += i
if len(tmp) > 0:
	un.append(tmp)
ans = 0
ans2 = 0
for i in br:
	for j in i.split('_'):
		if j != '':
			ans = ans + 1
for i in un:
	for j in i.split('_'):
		if j != '':
			ans2 = max(ans2, len(j))
print(ans2, ans)


from sys import stdin as fin
n = int(fin.readline())
line = fin.readline()
delim = ('(', ')', '_', '\n')
par = 0
cnt = cntin = maxout = 0
for sym in line:
	if sym not in delim:
		cnt += 1
	else:
		if par and cnt:
			cntin += 1
		else:
			maxout = max(cnt, maxout)
		cnt = 0
		if sym == '(':
			par += 1
		elif sym == ')':
			par -= 1
print(maxout, cntin)


n = int(input())
maxout = 0
numin = 0
currout = 0
currin = False
out = True
for char in input():
	if char in ['_', '(', ')']:
		if out and maxout < currout:
			maxout = currout
		currout = 0
		if not out and currin:
			currin = False
			numin += 1
		if char in ['(', ')']:
			out = not out
	elif out:
		currout += 1
	else:
		currin = True
if maxout < currout:
	maxout = currout
print(maxout, numin)


t = input()
t = '_' + input() + '_'
res = ''
for i in range(1, len(t)):
	if not (t[i] == '_' and t[i - 1] == '_') and (t[i] != '(' and t[i] != ')'):
		res += t[i]
	if t[i] == '(' or t[i] == ')':
		if t[i - 1] != '_':
			res += '_'
		res += t[i]
		if i != len(t) - 1:
			if t[i + 1] != '_':
				res += '_'
s = list(res.split('_'))
sk = False
n = 0
d = 0
for i in range(0, len(s)):
	if s[i] != '(' and s[i] != ')' and sk and (s[i] != ''):
		n += 1
	if s[i] != '(' and s[i] != ')' and (not sk) and (len(s[i]) > d):
		d = len(s[i])
	if s[i] == '(' or s[i] == ')':
		sk = not sk
print(d, n)


from sys import stdin, stdout
import re
n = int(stdin.readline())
inp = stdin.readline()[:n]
words = re.findall('[^\\W_]+|[()]', inp)
op = False
(high, word) = (0, 0)
for i in words:
	if i == '(' or i == ')':
		op = not op
	elif op == True:
		word += 1
	else:
		high = max(high, len(i))
stdout.write(str(high) + ' ' + str(word))


n = int(input())
w = list(input().split('('))
max_out_of_brackets = 0
total_words_in_brackets = 0
c = w[0].split('_')
for cur_w in c:
	max_out_of_brackets = max(max_out_of_brackets, len(cur_w))
w[0] = ''
for x in w:
	c = x.split(')')
	c[0] = c[0].split('_')
	for cur_w in c[0]:
		if len(cur_w) != 0:
			total_words_in_brackets += 1
	if len(c) > 1:
		c[1] = c[1].split('_')
		for cur_w in c[1]:
			max_out_of_brackets = max(max_out_of_brackets, len(cur_w))
print(max_out_of_brackets, total_words_in_brackets)


def string___ins__outs(string):
	string = string
	splted_by_op = string.split('(')
	ins = [x.split(')')[0] for x in splted_by_op if ')' in x]
	outs = [(x + '_').split(')')[-1] for x in splted_by_op]
	return (ins, outs)

def outs___max_len(outs):
	words = insouts___words(outs)
	if len(words) == 0:
		return 0
	lens = [len(x) for x in words]
	return max(lens)

def ins___nr(ins):
	words = insouts___words(ins)
	return len(words)

def insouts___words(inouts):
	words = []
	for string in inouts:
		words += string.split('_')
	words = [x for x in words if x != '']
	return words
string_len = int(input())
string = input()
(ins, outs) = string___ins__outs(string)
print(outs___max_len(outs), ins___nr(ins))


n = int(input())
s = input()
maxlen = 0
cntret = 0
slen = 0
cnt = 0
flag = 0
k = 0
j = 0
passcnt = 1
global i
for i in range(n):
	if i < k:
		continue
	if i < j:
		continue
	if s[i] == '_':
		pass
	elif s[i].isalpha and s[i] != '(' and (s[i] != ')'):
		k = i
		while s[k].isalpha() and s[k] != '_':
			slen = slen + 1
			if k == n - 1:
				break
			k = k + 1
		if slen > maxlen:
			maxlen = slen
		slen = 0
	elif s[i] == '(':
		j = i
		j = j + 1
		while s[j] != ')':
			if s[j] == '_':
				j = j + 1
			elif s[j].isalpha():
				while s[j].isalpha():
					j = j + 1
					flag = 1
				if flag == 1:
					cntret = cntret + 1
				flag = 0
if not maxlen:
	print('0', end=' ')
else:
	print(maxlen, end=' ')
if not cntret:
	print('0')
else:
	print(cntret)


n = int(input())
s = input()
L = 0
ind = 0
res = '_'
maxx = 0
maxx1 = 0
for i in range(len(s)):
	if s[i] == '(':
		if maxx > maxx1:
			maxx1 = maxx
		maxx = 0
		ind = 1
		continue
	if ind == 1:
		if s[i] == ')':
			if res[len(res) - 1] != '_':
				res += '_'
			ind = 0
			continue
		else:
			res += s[i]
	elif s[i] != '_':
		maxx += 1
	else:
		if maxx > maxx1:
			maxx1 = maxx
		maxx = 0
if maxx > maxx1:
	maxx1 = maxx
else:
	maxx = 0
N = 0
res = res.split('_')
for i in range(len(res)):
	if len(res[i]) != 0:
		N += 1
print(maxx1, N)


litter = input()
inside = outside = 0
s = input()
i = s.find('(')
while i != -1:
	last = s.find(')')
	for j in s[i + 1:last].split('_'):
		if j != '':
			inside += 1
	if i == 0:
		s = s[last + 1:]
	else:
		s = s[:i] + '_' + s[last + 1:]
	i = s.find('(')
for i in s.split('_'):
	if i != '':
		if len(i) > outside:
			outside = len(i)
print(outside, inside)


n = input()
string = input()
n = len(string)
longest_len = 0
word_inside = 0
curWord = []
inParen = False
for i in range(n):
	if string[i] == '_':
		if inParen:
			if len(curWord) > 0:
				word_inside += 1
		elif len(curWord) > longest_len:
			longest_len = len(curWord)
		curWord = []
	elif string[i] == '(':
		inParen = True
		if len(curWord) > longest_len:
			longest_len = len(curWord)
		curWord = []
	elif string[i] == ')':
		inParen = False
		if len(curWord) > 0:
			word_inside += 1
		curWord = []
	else:
		curWord.append(string[i])
if len(curWord) > longest_len:
	longest_len = len(curWord)
print(str(longest_len) + ' ' + str(word_inside))


n = int(input())
lst = input()
flag = 0
len = 0
num = 0
max = 0
for i in range(0, n + 1):
	if i == n:
		if max < len:
			max = len
		break
	if lst[i] == '_' or lst[i] == '(' or lst[i] == ')':
		if flag == 0 and max < len:
			max = len
		elif flag == 1 and len != 0:
			num += 1
		len = 0
		if lst[i] == '(':
			flag = 1
		elif lst[i] == ')':
			flag = 0
	else:
		len += 1
print(max, num)


def f(box):
	ret = []
	box = box.split('_')
	l = 0
	for i in box:
		if i != '':
			l = max(l, len(i))
			ret.append(i)
	return (l, ret)
l = int(input())
s = input()
data = [[], []]
ind = 0
open_b = 0
box = ''
mx_one = 0
mx_two = 0
for i in range(l):
	if open_b == 0:
		if s[i] == '(':
			(p, ms) = f(box)
			data[ind] += ms
			mx_one = max(mx_one, p)
			box = ''
			open_b = 1
			ind = 1
		else:
			box += s[i]
	elif s[i] == ')':
		(p, ms) = f(box)
		data[ind] += ms
		box = ''
		open_b = 0
		ind = 0
	else:
		box += s[i]
(p, ms) = f(box)
mx_one = max(mx_one, p)
data[0] += ms
print(mx_one, len(data[1]))


import re
from collections import defaultdict
num_letters = int(input())
text = str(input())
word_dict = defaultdict(bool)
inside_cnt = 0
words = list(filter(None, re.split('[\\s_()]', text)))
for w in words:
	word_dict[w] = True
inside_brackets = list(filter(None, re.findall('\\(([\\w_]*)\\)', text)))
for seq in inside_brackets:
	for w in list(filter(None, seq.split('_'))):
		inside_cnt += 1
		word_dict[w] = False
outside = [k for (k, v) in word_dict.items() if v is True]
inside = [k for (k, v) in word_dict.items() if v is False]
if len(outside) > 0:
	outside_longest = len(max(outside, key=lambda x: len(x)))
else:
	outside_longest = 0
print('{0} {1}'.format(outside_longest, inside_cnt))


n = input()
s = input()
arr = []
brr = []
x = 0
sub = ''
for i in s:
	if i == '(':
		x = 1
		if sub:
			arr.append(sub)
		sub = ''
		continue
	if i == ')':
		x = 0
		if sub:
			brr.append(sub)
		sub = ''
		continue
	if i == '_':
		if x:
			if sub:
				brr.append(sub)
		elif sub:
			arr.append(sub)
		sub = ''
	else:
		sub += i
if sub:
	arr.append(sub)
m = 0
for i in arr:
	m = max(m, len(i))
print(m, len(brr))


length = int(input())
string = input()
ans1 = 0
ans2 = 0

def ischar(a):
	ret = False
	if a >= 'a' and a <= 'z':
		ret = True
	if a >= 'A' and a <= 'Z':
		ret = True
	return ret
str_start = 1000
in_par = 0
length += 1
string += '_'
for i in range(length):
	if string[i] == '(':
		in_par = 1
		ans1 = max(ans1, i - str_start)
		str_start = 1000
	if string[i] == ')':
		in_par = 0
		if i > str_start:
			ans2 += 1
			str_start = 1000
	if in_par:
		if ischar(string[i]):
			str_start = min(i, str_start)
		if string[i] == '_' and i > str_start:
			ans2 += 1
			str_start = 1000
	else:
		if ischar(string[i]):
			str_start = min(i, str_start)
		if string[i] == '_':
			ans1 = max(ans1, i - str_start)
			str_start = 1000
print(str(ans1) + ' ' + str(ans2))


n = int(input())
s = input()
cnt = 0
mx = 0
c = 0
flg = 0
for x in s:
	if x == '_':
		if flg == 1 and c > 0:
			cnt += 1
		c = 0
	elif x == '(':
		flg = 1
		c = 0
	elif x == ')':
		flg = 0
		if c > 0:
			cnt += 1
		c = 0
	else:
		c += 1
		if flg == 0:
			mx = max(mx, c)
print(*[mx, cnt])


input()
line = input().replace(')', '(').split('(')
print(max([len(word) for subw in line[::2] for word in subw.split('_')]), len([word for subw in line[1::2] for word in subw.split('_') if word]))


import sys, re

def solve():
	lines = []
	for line in sys.stdin:
		if 'quit' in line:
			break
		lines.append(line[:-1])
	swords = 0
	line = lines[1]
	prewords = re.split('\\(|\\)', line)
	count = len(prewords)
	for i in range(1, count, 2):
		allword = prewords[i].split('_')
		for sword in allword:
			if len(sword) != 0:
				swords += 1
	maxw = 0
	for i in range(0, count, 2):
		allword = prewords[i].split('_')
		for sword in allword:
			if len(sword) > maxw:
				maxw = len(sword)
	print(maxw, swords)

def main():
	solve()
main()


input()
s = input()
f = False
a = []
for c in s:
	if c == '(':
		f = True
	if f == False:
		a.append(c)
	if c == ')':
		f = False
		a.append('_')
a = ''.join(a)
b = [len(s) for s in a.split('_') if s != ''] + [0]
c = sorted(b)[-1]
al = len(b) - 1
d = s.replace('_', ' ').replace('(', ' ').replace(')', ' ')
d = d.split()
print(c, len(d) - al, end=' ')


n = int(input())
ch = input()
a = []
b = []
t = False
for x in ch:
	if x == '(':
		t = True
		b.append('_')
		a.append('_')
	elif x == ')':
		t = False
		b.append('_')
		a.append('_')
	if t and x != '(' and (x != ')'):
		b.append(x)
	elif x != '(' and x != ')':
		a.append(x)
i = 0
s = 0
c = 0
while i < len(a):
	j = i
	while j < len(a):
		if a[j] == '_':
			break
		s = s + 1
		j = j + 1
	i = j + 1
	c = max(s, c)
	s = 0
i = 0
d = 0
while i < len(b):
	j = i
	while j < len(b):
		if b[j] == '_':
			break
		d = d + 1
		j = j + 1
		while j < len(b):
			if b[j] == '_':
				break
			j = j + 1
	i = j + 1
print(c, d)


n = int(input())
s = input()
bw = 0
bwl = 0
w = 0
mw = 0
open = False
for i in s:
	if i == '(':
		open = True
		if w != 0 and w > mw:
			mw = w
		w = 0
		continue
	elif i == ')':
		open = False
		if bw > 0:
			bwl += 1
		bw = 0
		continue
	if open:
		if i == '_':
			if bw > 0:
				bwl += 1
			bw = 0
		else:
			bw += 1
	elif i == '_':
		if w != 0 and w > mw:
			mw = w
		w = 0
	else:
		w += 1
if w != 0 and w > mw:
	mw = w
print(mw, bwl)


n = int(input())
a = '_' + input() + '_'
n += 2
per = 0
left = 0
a1 = []
a2 = []
for j in range(n):
	if a[j] == '(':
		per = 1
		if left != 0:
			a2.append(a[left:j])
		left = j + 1
	elif a[j] == ')':
		per = 0
		a1.append(a[left:j])
		left = j + 1
	elif a[j] == '_':
		if left == 0:
			left = 1
		else:
			if per == 1:
				a1.append(a[left:j])
			else:
				a2.append(a[left:j])
			left = j + 1
maxs = -float('infinity')
for j in range(len(a2)):
	if a2[j] != '':
		maxs = max(maxs, len(a2[j]))
if maxs != -float('infinity'):
	print(maxs, end=' ')
else:
	print(0, end=' ')
score = 0
for j in range(len(a1)):
	if a1[j] != '':
		score += 1
print(score)


n = int(input())
s = input()
k = 0
sk = 0
maxl = 0
c = 0
for i in range(len(s)):
	if s[i] == '(':
		maxl = max(c, maxl)
		k = 1
		c = 0
	elif s[i] == '_':
		if k == 1 and c > 0:
			sk += 1
			c = 0
		elif k == 0:
			maxl = max(c, maxl)
		c = 0
	elif s[i] == ')':
		k = 0
		if c > 0:
			sk += 1
		c = 0
	else:
		c += 1
maxl = max(maxl, c)
print(maxl, sk)