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: interview

Starter code:

Solutions:
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

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())
s = input()
s = s.replace('(', '_(_')
s = s.replace(')', '_)_')

word = s.split('_')

cntI = 0
mx = 0
inside = False

for w in word:
    if w == '':
        continue
    # print(w)
    if w == '(':
        inside = True
        continue
    if w == ')':
        inside = False
        continue

    if inside:
        cntI += 1
    else:
        mx = max(mx, len(w))

print(mx, cntI)


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

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()
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 = 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
    else:
        if op:
            b += 1
        else:
            a = max(len(element), a)

print(a, b)

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 = 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))

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)
        else:
            if cur > 0:
                c += 1
        cur = 0
    elif s[i] == '(':
        if not inbrackets:
            l = max(l, cur)
        else:
            if cur > 0:
                c += 1
        inbrackets = True
        cur = 0
    elif s[i] == ')':
        if not inbrackets:
            l = max(l, cur)
        else:
            if cur > 0:
                c += 1
        inbrackets = False
        cur = 0
    else:
        cur += 1

print(l, c)



#!/usr/bin/env python3

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)

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)

import sys, math
n = int(input())
s = input()
fl = 1
sk = 0
a = [0, 0]
gg = ['(', '_', ')']
i = 0
while i < n:
    #print(i)
    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)
        
        
    



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(ans[0])
# print(ans[1])

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().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())
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 = 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)


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(r'[()]', 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()


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


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


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



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
        else:
            if 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()