/*
 * shoflk kalba.cpp
 *
 *  Created on: Sep 17, 2016
 *      Author: A7mD Sa3iiD
 *		time: 11:15:28 PM
 */

#include <bits/stdc++.h>
#include<bitset>
using namespace std;
#define bye return 0
#define oo 0x3f3f3f3f
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define F  first
#define S  second
#define EPS 1e-9
#define khod push_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<int, int> mpii;
typedef map<ll, ll> mpll;
int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int dy[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
double PI = 3.1415926535897932384626433832795;
string vowel = "aeiouy";
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	/*#ifndef ONLINE_JUDGE
	 freopen("buy.in", "r", stdin);
	 freopen("output.txt", "w", stdout);
	 #endif*/
	int n ;
	string s ;
	cin>>n;
	cin.ignore();
	getline(cin,s);
	string tmp = s ;
	for(int i = 0; i < n ; i++){
		if(tmp[i]=='('){
			for(int j = i ; ;j++){
				if(tmp[j]==')'){tmp[j]='*';break;}
				tmp[j]='*';

			}
		}
		if(tmp[i]=='_')tmp[i]='*';
	}
	int cnt = 0 , c = 0;
	for(int i = 0 ; i < n ; i++){
		if(s[i]=='('){
			for(int j = i+1 ; ; j++){
				if(s[j]!='_'&&s[j]!=')')c++;
				else {
					if(c)cnt++;
					c=0;

				}
				if(s[j]==')'){c=0;i=j;break;}
			}
		}
	}
	int mx = 0 ;
	c = 0 ;
	for(int i = 0 ; i < n ; i++){
		if(tmp[i]=='*'){
			mx=max(mx,c);
			c=0;
		}
		else c++;

	}
	if(c)mx=max(mx,c);
	cout<<mx<<" "<<cnt;

	bye;
}

#include <bits/stdc++.h>
using namespace std;
void solve() {
    int n;
    cin >> n;
    string str;
    cin >> str;
    int count = 1;
    int max = 0;
    vector <int> v;
    for(int i=0;i<n;i++) {
        if(str[i] == '(') {
            while(str[i] != ')')
                i++;
        }
         else if(islower(str[i]) || isupper(str[i])) {
            v.push_back(i);
        }
    }
    if(v.size() == 0)
        cout << '0' << " ";
    else {
    for(int i=0;i<v.size()-1;i++) {
        if(v[i+1] == v[i]+1) {
            count++;
        }
        else {
            if(count > max)
                max = count;
            count = 1;
        }
    }
    if(count > max)
        max = count;
    cout << max << " ";
    }

    count = 0;
    // no of words inside parenthesis
    for(int i=0;i<n;i++) {
        if(str[i] == '(') {
            while(str[i] != ')') {
                i++;
                if(str[i] == '_')
                    continue;
                if(str[i] != '_' && str[i] != ')') {
                    while(str[i] != '_' && str[i] != ')') {
                        i++;
                    }
                    count++;
                }
            }
        }
    }
    cout << count << endl;
    return ;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
    return 0;
}

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

//int c[110];
//set <string> pas[110];

bool ok(string a, string b)
{
	return a.length() < b.length();
}

int main()
{
	//memset(c, 0, 110 * sizeof(int));
	long long n, k = 0, cnt = 0;

	cin >> n;

	string s;
	cin >> s;
	vector <string> w;
	string cur;
	bool inSk = 0, isStart = 0;
	int ansIn = 0, ansOut = 0;

	for (int i = 0; i < n; ++i)
	{
		if (s[i] == '(')
		{
			if (cur != "")
				w.push_back(cur);
			cur = "";
			isStart = 0;
			inSk = 1;
		}
		else
		{
			if (s[i] == ')')
			{
				if (isStart)
					++ansIn;
				isStart = 0;
				cur = "";
				inSk = 0;
			}
			else
			{
				if (s[i] == '_')
				{
					if (isStart)
					{
						if (!inSk)
							w.push_back(cur);
						else
							++ansIn;
					}
					isStart = 0;
					cur = "";
				}
				else
				{
					isStart = 1;
					cur += s[i];
				}
			}
		}
	}

	if (isStart)
	{
		if (cur != "")
			w.push_back(cur);
	}

	if (w.size() != 0)
	{
		sort(w.begin(), w.end(), ok);
		cout << (*(w.rbegin())).length() << ' ' << ansIn;
	}
	else
	{
		cout << 0 << ' ' << ansIn;
	}

	cin >> n;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update>
    ordered_set;*/
int dx[]={0,0,-1,1,-1,-1,1,1};
int dy[]={1,-1,0,0,-1,1,-1,1};

int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    //freopen("subin.in","r",stdin);
    //freopen("subout.out","w",stdout);
    int n,x=-1,mx=0,c=0,b=0;
    string s;
    cin>>n>>s;
    for(int i=0;i<n;++i)
    {
        if(s[i]=='_')
            mx=max(mx,i-x-1),x=i;
        if(i==n-1)
            mx=max(mx,n-x-1);
        else if(s[i]=='(')
        {
            mx=max(mx,i-x-1),x=i;
            for(int j=i+1;1;++j)
            {
                if(s[j]==')')
                {
                    i=j,x=j;
                    break;
                }
                if((s[j]!='_')&&(s[j-1]=='('||s[j-1]=='_'))
                    ++c;
            }
        }
    }
    cout<<mx<<" "<<c
    ;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int num,len,maxx,lenn,l,f=1;
char s[300];
int main()
{
	scanf("%d",&len);
	scanf("%s",s);
	for(int i=0;i<len;i++){
		if(s[i]=='('||s[i]==')'||s[i]=='_') f++;
		if(f==2){
			f=1;
			if(s[i]=='_'&&lenn!=0) if(l==1) num++,lenn=0;else if(lenn!=0) maxx=max(maxx,lenn),lenn=0;
			if(s[i]=='(') {l=1;if(lenn!=0) maxx=max(maxx,lenn);lenn=0;}
			if(s[i]==')') {l=0;if(lenn!=0) num++;lenn=0;}
		}
		if(s[i]>='A'&&s[i]<='Z') lenn++;
		if(s[i]>='a'&&s[i]<='z') lenn++;
	}
	if(lenn!=0&&f==1) maxx=max(maxx,lenn);
	printf("%d %d\n",maxx,num);
	return 0;
}

    #include<bits/stdc++.h>

    using namespace std;
        main(){
        string s;
        cin >> s;
        cin >> s;
        s +="_";
        string r="";
        string sqb="";
        int maxe = 0;
        bool in = false;
        for(int i = 0 ; i < s.size();i++){
            if(s[i]=='('){
                s[i]='*';
                for(int j = i+1;s[j] != ')';j++){
                    sqb += s[j];
                    s[j] ='*';
                }

                sqb+='_';
               }

        }

        for(int i = 0 ; i < s.size();i++){
            if(s[i]!='*' and s[i]!='_' and isalpha(s[i]))r+=s[i];
            else{

            int t = r.size();
            maxe = max(t,maxe);
            r="";

            }
        }

        int cnt = 0;
        r="";
        for(int i = 0 ; i < sqb.size();i++){
            if(sqb[i] != '_')r+=sqb[i];
            else{
                if(!r.empty())cnt++;
                r="";
            }
        }
        cout << maxe <<" "<<cnt;

        }

#define _USE_MATH_DEFINE
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>

using namespace std;

#define forn(i,n) for (int i=0;i<n;i++);

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int n;
	cin>>n;
	string s;
	cin>>s;

	int i=0;
	int in=0;
	int li=0;
	vector <int> l;
	while (i<n) {
		if (s[i]=='(')
	{
		i++;
		li=0;
		while (s[i]!=')') {

			if (s[i]!='_')
				li++;
			else if(s[i]=='_' && li!=0) {
				li=0;
				in++;
			}

			i++;
			}
		if (li!=0) in++;
		i++;
	}
		if (i<n&& s[i]=='_') i++;
		if (i<n &&  s[i]!='_' && s[i]!='(') {
			li=0;
			while (i<n && s[i]!='_' && s[i]!='(') {
				li++;
				i++;
			}
			l.push_back(li);
		}

	}
	int t;
	if (l.size()!=0) {
	sort(l.begin(),l.end());
	 t=l[l.size()-1];}
	else  t=0;
	cout << t <<" "<< in;

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
ll l;
ll f1()
{
    ll i,j,k,m,n,cnt=0,tmp=0;
    for(i=0;i<l;i++)
    {
        if(s[i]=='(')
        {
            //cout<<i<<endl;
            for(j=i;;j++)
            {
                if(s[j]==')')
                {
                    i=j;
                    break;
                }
            }
        }
        char c=s[i];
        if(isalpha(c))
        {
            tmp=0;
            for(j=i;j<l;j++)
            {
                char c=s[j];
                if(isalpha(c))
                {
                    tmp++;
                    if(cnt<tmp)
                        cnt=tmp;
                    //cout<<c<<" "<<tmp<<" "<<cnt<<endl;
                }
                else
                {
                    //cout<<c<<endl;
                    if(cnt<tmp)
                        cnt=tmp;
                    i=j-1;
                    break;
                }
            }
        }
    }
    return cnt;
}
ll cntw(ll m,ll n)
{
    //cout<<m<<" "<<n<<endl;
    ll i,j,k,cnt=0;
    for(i=m+1;i<n;i++)
    {
        char c=s[i];
        char d=s[i+1];
        if(isalpha(c)&&!isalpha(d))
            cnt++;
    }
    return cnt;
}
ll f2()
{
    ll i,j,k,m,n,cnt=0;
    for(i=0;i<l;i++)
    {
        if(s[i]==')')
        {
            i=i+1;
            continue;
        }
        if(s[i]=='(')
        {
            for(j=i+1;j<l;j++)
            {
                if(s[j]==')')
                {
                    cnt+=cntw(i,j);
                    i=j;
                    break;
                }
            }
        }
    }
    return cnt;
}
int main()
{
    ll i,j,k,m,n;
    while(cin>>l)
    {
        cin>>s;
        cout<<f1()<<" "<<f2()<<endl;
    }
    return 0;
}

#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <vector>
#include <deque>
#include <string>
#include <cstring>
#include <cstdio>
#include <tuple>
#include <utility>
#include <stack>
#include <functional>
#include <limits>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
//functions
#define fd(i,x,y) for(ll i=x;i>=y;i--)
#define fu(i,x,y) for(ll i=x;i<=y;i++)
#define cu(i,x,y) for(int i=x;i<y;i++)
#define cd(i,x,y) for(ll i=x;i>y;i--)
#define dp(i) printf("-%d-",i);

#define mp make_pair
#define mt make_tuple
#define pb push_back
//constants and types
#define MOD 1000000007
#define ll long long
#define MAXN 1e16
#define inf numeric_limits<int>::max()
#define PI 3.141592653589793238462643383279502884
using namespace std;
char s[255];
int n,q=0,mo=0,x=-1;
bool p=false;
int main(){
	scanf("%d",&n);
	scanf(" %s",s);
	cu(i,0,n){
		if(s[i]=='_'){
			if(p&i-x>1)q++;
			else if(!p)mo=max(mo,i-x-1);
			x=i;
		}
		else if(s[i]=='('){
			mo=max(mo,i-x-1);
			p=true;
			x=i;
		}
		else if(s[i]==')'){
			if(i-x>1)q++;
			p=false;
			x=i;
		}
	}
	if(x!=n-1)mo=max(mo,n-x-1);
	printf("%d %d",mo,q);
}

#include<bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a),_b=(b);i<=_b;i=i+1)
#define FORD(i,b,a) for (int i=(b),_a=(a);i>=_a;i=i-1)
#define REP(i,n) for (int i=0,_n=(n);i<_n;i=i+1)
#define FORE(i,v) for (__typeof((v).begin()) i=(v).begin();i!=(v).end();i++)
#define ALL(v) (v).begin(),(v).end()
#define fi   first
#define se   second
#define MASK(i) (1LL<<(i))
#define BIT(x,i) (((x)>>(i))&1)
#define div   ___div
#define next   ___next
#define prev   ___prev
#define left   ___left
#define right   ___right
#define __builtin_popcount __builtin_popcountll
using namespace std;
template<class X,class Y>
    void minimize(X &x,const Y &y) {
        if (x>y) x=y;
    }
template<class X,class Y>
    void maximize(X &x,const Y &y) {
        if (x<y) x=y;
    }
template<class T>
    T Abs(const T &x) {
        return (x<0?-x:x);
    }
const int INF = (int) 1e9 + 7;

using namespace std;
int main() {
//    while(1) {
        int n; cin>>n;
    string a; cin>>a;
    int check=0, dem1, dem2=0, Max=0;
    REP(i,n) {
        if(a[i]=='(') {
            FOR(j, i+1, n-1) {
                if(isalpha(a[j])) {
                    check = 1;
                } else if(a[j]=='_' && check) {
                    dem2++;
                    check = 0;
                } else if(a[j]==')' && check){
                    dem2++;
                    check = 0;
                    i=j-1;
                    break;
                } else if(a[j]==')') {
                    i=j-1;
                    break;
                }
            }
        } else if(isalpha(a[i])) {
            dem1=1;
            Max = max(dem1, Max);
            FOR(j,i+1,n-1) {
                if(isalpha(a[j])) {
                    dem1++;
                    Max = max(dem1, Max);
                } else if(a[j]=='_' || a[j]=='(') {
                    i=j-1;
                    break;
                }
            }
        }
    }
    cout<<Max<<" "<<dem2<<endl;
//    }

}

#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	//括号外单词长度
	//内个数
	int cnt = 0;//单词数
	int len_max = 0; int slen = 0; string str; cin >> slen; cin >> str;
	int templen = 0;
	for (int i = 0; i < slen; i++) {
		if (str[i] == '(') {
			if (templen > len_max) {
				len_max = templen;
				templen = 0;
			}

			while (str[i] != ')') {
				if (str[i] == '_') {
					if (str[i - 1] != '(' && str[i - 1] != '_')
						cnt++;
				}
				i++;
			}
			if (str[i - 1] != '(' && str[i - 1] != '_')
				cnt++;
		}
		if (i<slen && str[i] != '_' && str[i]!=')') {
			templen++;
		}
		else{
			if (templen > len_max) {
				len_max = templen;
			}
			templen = 0;
		}
	}
	if (templen > len_max) {
		len_max = templen;
	}
	cout << len_max << " " << cnt << endl;
}

#include <stdio.h>
#include <iostream>
#include <string.h>

using namespace std;

int main()
{
	long long n,max=0,num=0;
	char string[300];

	//freopen("list.txt","r",stdin);
	cin>>n;
	cin>>string;

	int check=0,length=0;
	for (int i=0;i<n;i++)
	{
		if (string[i]=='(')
			check=1;
		else if (string[i]==')')
			check=0;
		if (check==1)
		{
			length=0;
			if ((string[i]>='a'&&string[i]<='z')||(string[i]>='A'&&string[i]<='Z'))
				if (string[i+1]=='_'||string[i+1]==')')
					num++;
		}
		else if (check==0)
		{
			if ((string[i]>='a'&&string[i]<='z')||(string[i]>='A'&&string[i]<='Z'))
			{
				length++;
				if (string[i+1]=='('||string[i+1]=='_'||i==n-1)
				{
					if (max<length)
						max=length;
					length=0;
				}
			}
		}
	}
	cout<<max<<" "<<num;
}

#include <iostream>
using namespace std;
char str[500];
int x, y;
int main() {
	int i;
	int n;
	while (scanf("%d %s", &n, &str)!= EOF) {
		x = y= 0;
		int curLen = 0;
		int curNum = 0;
		int inside = 0;
		for (i = 0; str[i]; i++) {
			if (str[i] == '(') {
				inside ++;
				curLen=0;
			} else if (str[i] == ')') {
				inside --;
				if (curLen > 0) {
					curNum++;
				}
				curLen = 0;
			} else {
				if (inside > 0) {
					if (str[i] == '_') {
						if (curLen > 0) {
							curNum++;
						}
						curLen = 0;
					} else {
						curLen++;
					}
				} else {
					if (str[i] == '_') {
						curLen = 0;
					} else {
						curLen++;
						if (curLen > x) {
							x = curLen;
						}
					}
				}
			}
		}
		printf("%d %d\n", x, curNum);
	}
	return 0;
}

#include <iostream>
#include <vector>
#include <string.h>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

vector<string> inp;
vector<string> outp;

int main() {
    int len;
    string str;
    cin >> len >> str;
    str += "_";
    bool flag = true;
    char buf[512] = { 0 };
    int idx = -1;
    for (int i = 0; i < str.size(); i++) {
        char c = str[i];
        if (c == '(') {
            if (idx >= 0) {
                outp.pb(string(buf));
                memset(buf, 0, sizeof(buf));
                idx = -1;
            }
            flag = false;
        } else if (c == ')') {
            if (idx >= 0) {
                inp.pb(string(buf));
                memset(buf, 0, sizeof(buf));
                idx = -1;
            }
            flag = true;
        } else if (c == '_') {
            if (idx >= 0) {
                if (flag) outp.pb(string(buf));
                else inp.pb(string(buf));
                memset(buf, 0, sizeof(buf));
            }
            idx = -1;
        } else {
            buf[++idx] = c;
        }
    }
    int a = 0;
    for (int i = 0; i < outp.size(); i++) {
        a = max(a, (int)outp[i].size());
        //cout << a << endl;
    }
    cout << a << " " << inp.size() << endl;

}

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main () {

    string s;

    int counter = 0 ;
    int max = 0;
    int wcounter = 0;
    int j = 0;
int number;
cin>>number;
cin>>s;
int counter2=0;
int max2 = 0;
    for(int i = 0 ; i < s.length() ; i++){
        if(s.at(i) == '_'){
                counter =0;
            continue;
        }
        else if(s.at(i) >= 'A' && s.at(i) <= 'z'){
            ++counter;
        if(counter > max)
            max = counter;

        }

      else if(s.at(i) == '('){
counter  = 0;

            while(true)
            {
                ++i;
                if(s.at(i) == '_' || (s.at(i)==')' && max2 > 0)){
                        if(max2 > 0)
                        ++counter2;
                        max2 =0;

                }
                    else if(s.at(i) >= 'A' && s.at(i) <= 'z'){
                        ++max2;
                    }
             if(s.at(i)==')')
                    break;
            }

    }
    }
cout<<max<<" "<<counter2<<endl;
  return 0;

}

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define maxn 100010
#define mmaxn 1000000000
#define pii pair<int,int>
#define pll pair<ll int,ll int>
#define pdd pair<double,double>
#define MOD 1000000007
#define f first
#define s second
using namespace std;
int main(){
	int n;
	cin>>n;
	string a;
	cin>>a;
	int s1=1,  s2=0;
	int num_in_par=0;
	int max_len=0;
	int count=0;
	for(int i=0;i<n;i++){
		if(a[i]=='('){
			s1=0;
			s2=1;
			max_len=max(max_len,count);
			count=0;
		}
		if(s2==1){
			if(isalpha(a[i]) && i>=1 && !isalpha(a[i-1])){
				num_in_par++;
			}
		}
		if(s1==1){
			if(isalpha(a[i])){
				count++;
			}
			else{
				max_len=max(max_len,count);
				count=0;
			}
		}
		if(a[i]==')'){
			s1=1;
			s2=0;
		}
	}

	cout<<max(max_len,count)<<" "<<num_in_par<<"\n";
}

#include<bits/stdc++.h>
using namespace std;

//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("avx,avx2,fma")

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef set<int> si;
typedef set<ll> sll;
typedef map<int, int> mii;
typedef map<ll, ll> mll;

const double pi = acos(-1.0);
const long long INF = 2e18;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define in insert
#define endl "\n"

#define sqr(a) ((a) * (a))
#define jor(a) !(a&1)// jor means EVEN number
#define bjor(a) (a&1)// bjor means ODD number

#define all(a)  a.begin(), a.end()
#define mem(arr, b) memset(arr, b, sizeof(arr)) //memset only for -1 and 0
//fill(a, a+n, 5) //fill for any value

#define for0(i,b) for(int i=0;i<(b);i++)
#define for1(i,b) for(int i=1;i<=(b);i++)
#define forab(i,a,b) for(int i=(a);i<=(b);i++)
#define forba(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fileRead freopen("input.txt", "r", stdin);
#define fileWrite freopen("output.txt", "w", stdout);

void print(int a[], int n){ // for testing or debugging
    for(int i=0;i<n;i++)cout<<a[i]<<" "; cout<<endl;
}

///--------------------------------------------------------------------------

int wordcount(string s)
{
    int ans=0;
    int c=0;
    for0(i,s.sz){
        if(s[i]=='_' and c>0) ans++, c=0;
        else if(s[i]!='_')c++;
    }
    if(c) ans++;
    return ans;
}

int main()
{

    IOS;
    //fileRead
    int tc = 1;
    //cin>>tc;
    while(tc--)
    {
        int n; cin>>n;
        string s; cin>>s;

        vector<string>inpar;
        for0(i,n){
            if(s[i]=='('){
                i++;
                string t="";
                while(s[i]!=')') t+=s[i], s[i]='_', i++;
                inpar.pb(t);
            }
        }

        int totalword=0;
        for(auto t: inpar){
            if(t.sz!=0){
                totalword += wordcount(t);
            }
        }

        int mxlen=0, c=0;
        for0(i,n){
            if(s[i]=='(' or s[i]==')' or s[i]=='_') mxlen=max(mxlen, c), c=0;
            else c++;
        }
        mxlen=max(mxlen, c);
        cout<<mxlen<<" "<<totalword;
    }
}

#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
typedef bitset<15>mask;
#define F first
#define FF first.first
#define FS first.seocnd
#define S second
ll n,m,x,y,z,k,sol,sum,ans,l,r,xx,yy,a[1000000],b[1000000];
vector<ll>v;
vector<ll>v1;
vector<ll>v2;
pair<ll,pair<ll,ll> >pp[1000000];
pair<ll,ll>p[1000000];
map<ll,ll>ma;
string s1,s2,s;
char c;
int main()
{
//freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
      cin>>n;
      cin>>s;
      for(int i=0;i<s.size();i++){
        if(s[i]=='_'){
            x=max(x,sum);
            sum=0;
        }
        else if(s[i]=='('){
            x=max(x,sum);
            sum=0;
            while(s[i]!=')'){
                i++;
            }

           }
           else sum++;
          // cout<<sum<<endl;
      }
      x=max(x,sum);
      sum=0;
      for(int i=0;i<s.size();i++){
            sum=0;
        if(s[i]=='('){
            i++;
            while(s[i]!=')'){
                if(s[i]=='_'){
                    ans+=sum;
                    sum=0;
                }
                else sum=1;
                i++;
            }
            ans+=sum;
           }

     // cout<<ans<<endl;
      }
      cout<<x<<" "<<ans<<endl;

    return 0;
}

#include <iostream>
#include <string>
#include <vector>

void answer(unsigned x, unsigned y)
{
    std::cout << x << ' ' << y << '\n';
}

void solve(const std::string& s)
{
    std::vector<std::string> w[2];

    size_t i = 0;
    std::string a;
    for (const char c : s) {
        if (c != '_' && c != '(' && c != ')') {
            a.push_back(c);
            continue;
        }

        if (!a.empty()) {
            w[i].push_back(a);
            a.clear();
        }

        if (c != '_')
            i = (c == '(');
    }
    if (!a.empty())
        w[0].push_back(a);

    size_t k = 0;
    for (const std::string& a : w[0])
        k = std::max(k, a.length());

    answer(k, w[1].size());
}

int main()
{
    size_t n;
    std::cin >> n;

    std::string s;
    std::cin >> s;

    solve(s);

    return 0;
}

#include<iostream>
#include <algorithm>
#include <cmath>
#include <set>
#include<map>
#include<iomanip>
#include <string>
#include <vector>
#include<unordered_map>
#include<unordered_set>
using namespace std;

typedef long long unsigned llu;
typedef long double ld;
#define ll long long
#define PI 3.14159265358979323846
#define For(i, a, b) for (int i = a, sz = (int)b; i < sz; i++)
#define rFor(i, a, b, c) for (int i = (a); i >= (b); i -= (c))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define fill(a, b) memset(a, b, sizeof(a))
#define IO ios_base::sync_with_stdio(false), cin.tie(0),cout.tie(0)
const ll mod = 1000000007;
const ll inf = 1000000000009;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) { return a*b/gcd(a,b);}

//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

int main()
{
	IO;
	int n{},ans{},cnt{},res{},index{-1};
	cin>>n;
	string s;
	cin>>s;
	For(i,0,n)
	{
		if(s[i]=='_' || s[i]=='(')
			ans=max(ans,cnt),cnt=0;
		else if((s[i]>='a' && s[i]<='z') ||(s[i]>='A' && s[i]<='Z'))
				cnt++;
		if(s[i]=='(')
		{
			vector<int>v;
			for(int j=i;s[j]!=')';j++)
			{
				if(s[j]=='_' || s[j]=='(')v.push_back(j);
				index=j;
			}
			if(index !=-1)v.push_back(index+1),i=index+1;
			if(!v.size() && index !=-1)res++;
				For(k,0,v.size()-1)if(v[k+1]-v[k]>1)res++;
		}
	}
	if(s[n-1]!='(' || s[n-1]!='_' || s[n-1]!=')')ans=max(ans,cnt);
	cout<<ans<<" "<<res<<"\n";
//	system("pause");
	return 0;
}

#include <iostream>
#include <string>

int main()
{
    int n; std::cin >> n;
    std::string s;
    int currentWord = 0, longestWord = 0, wordsIn = 0;
    bool par = false;
    std::cin.clear(); std::cin.ignore(10, '\n'); s.resize(n + 2);
    std::getline(std::cin, s);

    for(int i = 0; i < n; i++) {
        switch (s[i])
        {
        case '(':
            par = true;
            if (i > 0 && isalpha(s[i - 1])) {
                if (currentWord > longestWord)
                    longestWord = currentWord;
            }
            currentWord = 0;
            break;
        case ')':
            par = false;
            if (isalpha(s[i - 1]))
                wordsIn++;
            break;
        case '_':
            if (par) {
                if (i > 0 && isalpha(s[i - 1]))
                    wordsIn++;
            }
            else {
                if (currentWord > longestWord)
                    longestWord = currentWord;
                currentWord = 0;
            }
            break;
        default:
            if (!par)
                currentWord++;
            break;
        }
    }

    int lastWord = 0;
    for (int i = n - 1; i >= 0; i--) {
        if (isalpha(s[i]))
            lastWord++;
        else
            break;
    }
    if (lastWord > longestWord)
        longestWord = lastWord;

    std::cout << longestWord << ' ' << wordsIn;
}

//It is made by jump~
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <ctime>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long LL;
int n,ans,ans2,cnt2;
char ch[256];
inline int getint()
{
    int w=0,q=0; char c=getchar();
    while((c<'0' || c>'9') && c!='-') c=getchar(); if(c=='-') q=1,c=getchar();
    while (c>='0' && c<='9') w=w*10+c-'0', c=getchar(); return q ? -w : w;
}
inline void work(){
    n=getint(); scanf("%s",ch); int now,cnt;
    for(int i=0;i<n;i++) {
	if(ch[i]=='(') {
	    ans=max(ans,cnt2); cnt2=0;
	    now=i+1; cnt=0;
	    while(ch[now]!=')') {
		if(ch[now]=='_') {
		    if(cnt!=0) ans2++;
		    cnt=0;
		}
		else cnt++;
		now++;
	    }
	    if(cnt!=0) cnt=0,ans2++;
	    i=now;
	}
	else{
	    if(ch[i]=='_') {
		if(cnt2!=0) ans=max(cnt2,ans);
		cnt2=0;
	    }
	    else cnt2++;
	}
    }
    if(cnt2!=0) ans=max(ans,cnt2);
    printf("%d %d",ans,ans2);
}

int main()
{
    work();
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define fo(i,n)   for(i=0;i<(n);++i)
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define endl '\n'
#define PI 3.1415926535897932384626433832795
#define all(x) x.begin(), x.end()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

const ll inf = LONG_MAX;
const ll arr = 2000000; /// 10^6

int main(void)
{
    ll n;
    cin >> n;
    string s;
    cin >> s;

    ll ans2 = 0;
    ll ans1 = 0;

    int i = 0;
    string s2 = "";
    s2+='_';
    //n++;
    for(i=0; i<n; i++)
    {
        if(s[i]=='(')
        {
            s2+='_';
            string s1 = "";
            for(int j=i+1; j<n; j++)
            {
                if(s[j]!=')') s1+=s[j]; else
                {
                    i = j;
                    break;
                }
            }
            bool f=false;
            ll t = 0;
            s1+='_';
            for(int j=0; j<s1.size(); j++)
            {
                if(s1[j]=='_'&&f) f=false, t++; else
                if(s1[j]!='_'&&f==false) f=true;
            }
            ans2+=t;
            //cout << s1 << " " << t << endl;
        } else s2+=s[i];
    }

    bool f=false;
    ll t = 0;
    ll k = 0;
    s2+='_';
    //cout << s2 << endl;
    for(int i=0; i<s2.size(); i++)
    {
        if(s2[i]!='_') k++; else ans1 = max(ans1, k), k=0;
    }
    ans1 = max(ans1, k);

    cout << ans1 << " " << ans2 << endl;

    return 0;
}

#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cctype>
#define MAXN 2005
#define ll long long
using namespace std;
int dir[8][2]={1,0,0,1,-1,0,0,-1,1,-1,-1,1,-1,-1,1,1};

int val[MAXN];
char str[MAXN];
int sor[MAXN];
int num[MAXN];

int main()
{
    int n,k,p,q;
    while(scanf("%d",&n)!=EOF)
    {
        scanf("%s",str);
        int flag=0;
        p=0;
        q=0;
        k=0;
        for(int i=0;i<=n;i++)
        {
            if(str[i]=='(')
            {
                flag=1;
                continue;
            }
            if(str[i]==')')
            {
                flag=0;

            }

            if(!flag)
            {
                if(isalpha(str[i]))
                {
                    ++k;

                }
                else
                {
                    p=max(k,p);
                    k=0;
                }
            }

            if(flag)
            {
                if(str[i]!='_'&&(str[i+1]==')'||str[i+1]=='_'))
                {
                    ++q;
                }
            }
        }
        printf("%d %d\n",p,q);
    }
}

#include <iostream>
#include <cstring>

using namespace std;

// 50 // _F_()___(____q)H_(__)__(_____p________o_)__Bz()___

int main()
{
    int n, largestwordindex, counter1=0, longest=0, wordcount=0, paren;
    cin>>n;
    char c[n];
    cin>>c;
    bool inside=false, word=false;
    for (int i=0; i<strlen(c); i++) {
        if (c[i]=='(') {
                inside=true;
                counter1=0;
                continue;
            }
        if (c[i]==')') {
                inside=false;
                word=false;
                continue;
        }
        if (inside==false) {
            if (c[i]!='_') {
                counter1++;
                if (c[i+1]==NULL) {
                    if (longest<counter1) {
                        longest=counter1;
                    }
                }
            }
            if (c[i]=='_' || c[i+1]=='(') {
                    if (longest<counter1) {
                longest=counter1;
                    }
                counter1=0;
                continue;
            }
        }
        if (inside==true) {
                if (c[i]!='_' && word==false) {
                    word=true;
                    wordcount++;
                    continue;
                }
                if (c[i]=='_' && word==true) {
                    word=false;
                    continue;
                }
        }
    }
    cout<<longest<<" "<<wordcount<<endl;
    return 0;
}

#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n,ans1=0,ans2=0;
char st[300];
bool y[300];
int len;
void search(int x)
{
	int k=x;
	if(st[x+1]==')')return;
	for(int i=x;i<len;i++){
		y[i]=true;
		y[x]=false;
		if(st[i]=='_'||st[i]==')'||st[i]==' '){
			k=i-k;
			if(k>1)ans1++;
			k=i;
		}
		if(st[i]==')'){y[i]=false;return;}
	}
}
int main()
{
	scanf("%d",&n);
	getchar();
	gets(st);
	len=strlen(st);
	for(int i=0;i<len;i++){
		if(st[i]=='(')
		search(i);
	}
	int cnt=0;
	for(int i=0;i<len;i++){
		if(!y[i]){
			if(st[i]=='_'||st[i]==' '||st[i]=='('||st[i]==')'){ans2=max(ans2,cnt);cnt=0;}
			if(st[i]!='_'&&st[i]!=' '&&st[i]!='('&&st[i]!=')')cnt++;
		}
		ans2=max(ans2,cnt);
	}
	printf("%d %d",ans2,ans1);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

vector<int> vec, v;

int main() {
    int n; cin >> n;
    string s; cin >> s;
    s.push_back('.');
    for (int i = 0; i < s.size(); i++) {
        if (('A' <= s[i] && s[i] <= 'Z') || ('a' <= s[i] && s[i] <= 'z')) continue;
        else vec.push_back(i);
        if (s[i] == '(') v.push_back(i);
        if (s[i] == ')') v.push_back(i);
    }
    int ans;
    if (vec[0] != '(') ans = vec[0] - 0;
    else if (vec[0] > 0) ans = vec[0];
    else ans = 0;
    int cnt = 0;
    for (int i = 1; i < vec.size(); i++) {
        if (vec[i] - vec[i - 1] > 1) {
            int flag = 0;
            for (int j = 1; j < v.size(); j += 2)
                if (vec[i - 1] >= v[j - 1] && vec[i] <= v[j]) {
                    flag = 1; break;
                }
            if (flag) cnt++;
            else
                ans = max(ans, vec[i] - vec[i - 1] - 1);
        }
    }
    cout << ans << " " << cnt << endl;
    return 0;
}

#include <iostream>
#include <algorithm>
#include <ctype.h>
#include <stack>
using namespace std;

int main(){
bool inbracket=false,stacking=false;long n,i,j=0;
int words=0,letters[250],flag=0,he=0,answer;
string sentence;
cin>>n;
cin>>sentence;

stack<char>outside;
if(n==1&&sentence[0]=='_')
answer=words=0;

else{
for(i=0;i<n;i++)
{
  if(sentence[i]=='(')
  {inbracket=true;
  continue;}

  if(sentence[i]==')')
  {
      inbracket=false;
      flag=0;
      outside.push('_');
      continue;
  }

  if(inbracket)
  {
      if(isalpha(sentence[i])&&flag==0)
      {
         words++;
         flag=1;

      }
      if(sentence[i]=='_')flag=0;

  }
  if(!inbracket)
  {
      stacking=true;
     outside.push(sentence[i]);
  }

  }
  if(stacking==true){
  letters[0]=0;
  while(outside.top()=='_')
  {
      outside.pop();
  }

  while(!outside.empty())
  {
      if(isalpha(outside.top()))
      {
          outside.pop();
          letters[j]++;
      }
      else
        {
            j++;
            letters[j]=0;
            outside.pop();

        }
  }
  sort(letters,letters+j+1);
   answer=letters[j];

  }
  else
    answer=0;

}
cout<<answer<<" "<<words;

	return 0;
}

#include <iostream>
#include <cstdio>

using namespace std;

bool skobka,in;
int max_sch1,sch2,sch,n;
string s;

int main()
{
    cin>>n;
    cin>>s;
    for (int i=0;i<n;i++)
    {
        if (s[i]=='(')
            skobka=true;

        if (s[i]==')')
            skobka=false;

        if (skobka==false)
        {
            if (s[i]!='_' && s[i]!='(' && s[i]!=')')
                sch++;
            else
            {
                max_sch1=max(max_sch1,sch);
                sch=0;
            }
        }

        if (skobka)
        {
            if (s[i]!='_' && s[i]!='(' && s[i]!=')' && in==false)
            {
                sch2++;
                in=true;
            }
            else if (s[i]=='_' || s[i]=='(' || s[i]==')')
                in=false;
        }
    }
    max_sch1=max(max_sch1,sch);
    cout<<max_sch1<<" "<<sch2<<endl;
    return 0;
}

#include <stdio.h>

#include <stdlib.h>
#include <iostream>
using namespace std;
int main() {

       char cr[255];
       int i;
       cin >> i;
       cin >> cr;
       int j;
       int letra=0;
       int sigLetra=0;
       int nDentro=0;
       int curLen = 0;
       int LenMax=0;
       int parentesis =0;
       int sigNoLetra=0;

       for (j = 0; j <i; j++){
              if (cr[j] =='('){
                     parentesis = 1;

              }
              if (cr[j] ==')'){
                     parentesis = 0;
              }

              letra = cr[j] != '_' && cr[j] != ')' && cr[j] != '(';

              sigNoLetra = cr[j+1] == '_' || cr[j+1] == ')' || cr[j+1] == '(';

              if (letra && sigNoLetra && parentesis){
                     nDentro++;
              }

              if (letra && !parentesis){
                     curLen++;
              }
              if((!letra && !parentesis )|| (j== i-1)){
                     if(curLen > LenMax)
                            LenMax = curLen;
                     curLen =0;
              }

             }

       cout <<LenMax<<" "<< nDentro;

}

#include <iostream>
#include <cstdio>
using namespace std;
char a[300];
int main()
{
    int n;
    cin>>n;
    getchar();
    bool flag=1;
    int temp=0,maxa=0,ans=0;
    for(int i=1;i<=n;i++)
    {
    	scanf("%c",&a[i]);
    }
    for(int i=1;i<=n;i++)
    {
    	if(a[i]=='(')
    	{
    		flag=0;
    		if(temp>maxa)
                	maxa=temp;
                temp=0;
    		continue;
    	}
    	if(a[i]==')')
    	{
    		flag=1;
    		if(a[i-1]!='_'&&a[i-1]!='(')
    			ans++;
    		continue;
    	}
    	if(flag)
    	{
    		if(a[i]!='_')
               temp++;
             else
             {
             while(a[i]=='_')
             	i++;
             	i--;
                if(temp>maxa)
                	maxa=temp;
                temp=0;
             }
             if(i==n)
             {
             	if(temp>maxa)
                	maxa=temp;
             }
    	}
    	else
    	{
            if(a[i]=='_')
            {
            	int c=i;
            	while(a[i]=='_')
            		i++;
            	i--;
            	if(c==0||a[c-1]!='(')
            	ans++;
            }
    	}
    }
    cout<<maxa<<" "<<ans<<endl;
}

#include<bits/stdc++.h>
#define ll long long int
#define forn(n1,n2) for(ll i=n1;i<n2;i++)
#define w(t) ll t;cin>>t;while(t--)
#define en "\n"
using namespace std;
ll i,n,m,x,y,z,j,k,l,mn=LLONG_MAX,mx=0,c,a[100005],r,s,cnt=0,sum=0;
string str;char ch;
vector<vector<ll>>g;
bool v[1000];
void swap(int *xp, int *yp)
{
    int temp = *xp;
    *xp = *yp;
    *yp = temp;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n;cin>>str;ll p=0,len=0;
    str="_"+str;
    str=str+"_";
    for(i=0;i<n+2;i++)
    {
        ch=str[i];
        if(cnt==0)
        {
            if(ch!='_' && ch!='(' && ch!=')')
            len++;
            else mx=max(mx,len),len=0;
        }
        else
        {
            if((ch==')' || ch=='_'))
            {
                if(k==1)
                {p+=c;c=0;k=0;}
            }
            else
            {c=1;k=1;}
        }
        if(ch=='(')
        c=0,k=0,cnt=1;
        if(ch==')')
        cnt=0;
    }
    cout<<mx<<" "<<p;
    return 0;
}

#include <iostream>
#include <tuple>
#include <cctype>
using namespace std;

auto solution(const string& input) -> tuple<int, int> {
    int longest_word_outside = 0;

    int word_length = 0;
    int number_words = 0;

    bool inside = false;
    bool pre_is_alpha = false;
    for(auto s : input) {
        if (s == '(') {
            inside = true;
            if (word_length > longest_word_outside)
                longest_word_outside = word_length;
            word_length = 0;
            pre_is_alpha = false;
            continue;
        }
        if (s == ')') {
            inside = false;
            pre_is_alpha = false;
            continue;
        }
        if (!inside && s == '_') {
            if (word_length > longest_word_outside)
                longest_word_outside = word_length;
            word_length = 0;
            pre_is_alpha = false;
            continue;
        }
        if (!inside && isalpha(s)) {
            ++ word_length;
            continue;
        }
        if (inside) {
            if (s == '_') {
                pre_is_alpha = false;
                continue;
            }
            if (isalpha(s)) {
                if (!pre_is_alpha)
                    ++ number_words;
                pre_is_alpha = true;
                continue;
            }
        }
    }
    if (word_length > longest_word_outside)
        longest_word_outside = word_length;
    return {longest_word_outside, number_words};
}

int main(int argc, char* argv[]) {
    int length;
    cin >> length;
    string input;
    cin >> input;

    auto ret = solution(input);
    cout << std::get<0>(ret) << ' ' << std::get<1>(ret) << '\n';
    return 0;
}

#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define sqr(x) ((x * x))
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define frp freopen("input.txt", "r", stdin); \
		    freopen("output.txt", "w", stdout);

typedef long long ll;
typedef vector <int> vi;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int maxn = (int)1e5 + 6;
const int inf = (int)1e9 * 2;
const int mod = (int)1e9 + 7;

int n, m, k,a[maxn*2], b[maxn], maxi = 0,sum , mini = inf, cnt;
bool ok = 0;
int main(){

	cin >> n;
	string s;
	cin.ignore();
	getline(cin, s);

	for(int i = 0; i < n; i++){
		if(s[i] == '('){
			cnt = 0;
			while(s[i] != ')'){
				if(isalpha(s[i]) ){
					ok = true;
				}
				else if ((s[i]=='_') && ok == true){
					sum++;
					ok = false;
				}

				i++;
			}
				if(ok == true){
					sum++;
					ok = false;
				}
		}
		else{
			if(isalpha(s[i])){
					cnt++;
					//cout<<s[i];
					maxi = max(maxi, cnt);
				}
			else if(s[i] == '_' || s[i] == '('){
				maxi = max(maxi, cnt);
				cnt = 0;
			}

		}

	}

	cout<<maxi<<" "<<sum;

	return 0;
}

/// Bismilla~hir Rahma~nir Rahi~m ///

#include <bits/stdc++.h>

using namespace std;

// definitions

#define pi  acos(-1.0)
#define ll  long long
#define ull unsigned long long
#define ff  first
#define ss  second
#define pb  push_back
#define all(v) v.begin(),v.end()
#define Case(cs) printf("Case %d: ",++cs)

//CONSTANT

#define mx7   10000007
#define mx6   1000006
#define mx5   100005
#define inf   1<<30 //infinity value
#define eps   1e-9
#define mx    (65540)
#define mod   1000000007

// I/O

#define sf                   scanf
#define pf                   printf

#define sf1(a)               scanf("%d", &a)
#define sf2(a,b)             scanf("%d%d",&a, &b)
#define sf3(a,b,c)           scanf("%d%d%d", &a, &b, &c)
#define sf4(a,b,c,d)         scanf("%d%d%d%d", &a, &b, &c, &d)
#define sf5(a,b,c,d,e)       scanf("%d%d%d%d%d", &a, &b, &c, &d, &e)

#define sll1(a)              scanf("%I64d", &a)
#define sll2(a,b)            scanf("%I64d%I64d", &a, &b)
#define sll3(a,b,c)          scanf("%I64d%I64d%I64d", &a, &b, &c)
#define sll4(a,b,c,d)        scanf("%I64d%I64d%I64d%I64d", &a, &b, &c, &d)

#define pf1(a)               printf("%d\n",a)
#define pf2(a,b)             printf("%d %d\n",a,b)
#define pf3(a,b,c)           printf("%d %d %d\n",a,b,c)
#define pf4(a,b,c,d)         printf("%d %d %d %d\n",a,b,c,d)

#define pll1(a)              printf("%I64d\n",a)
#define pll2(a,b)            printf("%I64d %I64d\n",a,b)
#define pll3(a,b,c)          printf("%I64d %I64d %I64d\n",a,b,c)
#define pll4(a,b,c,d)        printf("%I64d %I64d %I64d %I64d\n",a,b,c,d)

#define READ                 freopen("input.txt", "r", stdin);
#define WRITE                freopen("output.txt", "w", stdout);

//loops

#define fep(i,a,b)            for(i=a;i<=b;i++)
#define fem(i,a,b)            for(i=a;i>=b;i--)
#define fp(i,a,b)             for(i=a;i<b;i++)
#define fm(i,a,b)             for(i=a;i<b;i++)

bool isChar(char c){
    if((c >= 'A' && c<='Z') || (c>='a' && c<='z')) return 1;
    else return 0;
}

int main()
{
    //READ
    int n,c=0,l=0,ansl=0;
    string s;
    cin >> n;
    cin >> s;

    bool p =0,cr=0;
    for(int i=0;i<n;i++){
        if(s[i]=='(') p=1;
        if(s[i]==')'){p=0; l=0;}

        if(p){
            if(isChar(s[i]) && cr) continue;

            if(isChar(s[i])){
                cr=1;
                c++;
            }
            else cr=0;
        }
        else{
            if(isChar(s[i]) && cr){
                l++;
                ansl=max(ansl,l);
            }

            else if(isChar(s[i]) && l==0){
                cr=1;
                l++;
                ansl=max(ansl,l);
            }
            else{
                ansl=max(ansl,l);
                l=0;
                cr=0;
            }
        }
    }
    ansl=max(ansl,l);
    cout << ansl << " " << c << endl;

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

string s;
int n;
int main()
{
	cin>>n>>s;
	int t=0,ans1=0,ans2=0,last=0;
	s+="_";
	for(int i=0;i<(int)s.size();i++)
	{
		if((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z'));
		else
		{
			if(last!=i)
			{
				if(t==1)ans2++;
				else ans1=max(ans1,i-last);
			}
			last=i+1;
		}
		if(s[i]=='(')t++;
		else if(s[i]==')')t--;
	}
	printf("%d %d\n",ans1,ans2);
	return 0;
}

#include<bits/stdc++.h>

#define X  first
#define Y  second
typedef long long ll;

#define FOR(i,a,b) for(ll i = a;i<=b;i++)
#define FOD(i,a,b) for(ll i = a;i>=b;i--)
#define pb push_back
#define mp make_pair

using namespace std;

typedef pair<ll,ll>ii;
const ll maxN = 1e6+5;
const ll inf = 1e10;
const ll mod = 1e9+7;
ll n;
string s;
vector<string>res1,res2;
int main()
{
    ios_base::sync_with_stdio(0);
	cin>>n;
	cin>>s;
	ll ok = 0;
	string tam = "";
	FOR(i,0,n-1)
	{
		if(s[i] != '_' && s[i] != '(' && s[i] != ')')tam += s[i];

		if(s[i] == '_' || s[i] == ')' || s[i] == '(')
		{
			if(tam != "")
			{
		//		cout<<tam<<" "<<ok<<endl;
				if(ok == 1)res2.pb(tam);
				else res1.pb(tam);
				tam = "";
			}
		}
		if(s[i] == '(')ok = 1;
		if(s[i] == ')')ok = 0;
	}
	if(tam != "")
	{
		if(ok == 1)res2.pb(tam);
		else res1.pb(tam);
		tam = "";
	}
	ll mx = 0;
	for(ll i = 0;i<res1.size();i++)
	{
		ll tam = res1[i].size();
		mx = max(mx,tam);
	}
	cout<<mx<<" "<<res2.size();
	return 0;
}

#include <cstdio>
#include <cctype>
#include <cstring>
using namespace std;
char s[300];
int main()
{
///freopen("1.in","r",stdin);
   /// freopen("1.out","w",stdout);
    int i,j,k;
    scanf("%d\n",&i);
    gets(s);
    int n=strlen(s);
    int paranteza=0;
    int cnt1=0,cnt2=0,maxx=0;
    for(i=0; i<n; i++)
    {
        if((s[i]>='A' && s[i]<='Z') || (s[i]>='a' && s[i]<='z'))
        {
            cnt1++;
        }
        else if(s[i]=='_')
        {
            if(paranteza==0)
            {
                if(cnt1>maxx)
                    maxx=cnt1;
            }
            else
            {
                if(cnt1>0)
                cnt2++;
            }
            cnt1=0;
        }
        else if(s[i]=='(')
            {paranteza=1;
            if(cnt1>maxx)
            maxx=cnt1;
            cnt1=0;}
        else if(s[i]==')')
            {
                if(s[i-1]!='_'&&s[i-1]!='(')
                cnt2++;
                paranteza=0;
                cnt1=0;
            }
    }
    if(cnt1>0)
    {
        if(cnt1>maxx)
        maxx=cnt1;
    }
    printf("%d %d",maxx,cnt2);
    return 0;
}

#include <bits/stdc++.h>

#define ll long long
#define trav(s , it) for(auto& it : s)
#define all(x) x.begin(),x.end()
#define FixTo(x , y) cout.precision(y),cout << fixed << x
#define AbRu315 ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define endll cout<<'\n'
#define no cout<<"NO"<<'\n'
#define yes cout<<"YES"<<'\n'
#define F first
#define S second

ll maxll(ll _1,ll _2){return (_1>_2?_1:_2);}
ll minll(ll _1,ll _2){return (_1<_2?_1:_2);}
ll dig2 (ll n){return log2(n)+1;}

using namespace std;

int main()
{
    AbRu315
    ll n;
    cin>>n;
    char s[260];
    cin>>s;
    ll max=0,cnt=0,cnt1=0;
    bool b=0;
    for(int i=0;i<n;i++){
        if(s[i]=='('){
            for(;i<n;i++){
                if( ( (s[i]>='a'&&s[i]<='z')||
                      (s[i]>='A'&&s[i]<='Z')) && !b)
                    cnt++,b=1;
                else if(s[i]=='_')
                    b=0;
                else if(s[i]==')'){
                    b=0;
                    i--;
                    break;
                }
            }
        }
        else if((s[i]>='a'&&s[i]<='z')||
                (s[i]>='A'&&s[i]<='Z') ){
                for(;i<n;i++){
                    if(s[i]=='_'||s[i]=='('){
                        max=maxll(max,cnt1);
                        i--;
                        cnt1=0;
                        break;
                    }
                    else
                        cnt1++;
                    if(i==n-1)
                        max=maxll(max,cnt1);
            }
        }
    }
    cout<<max<<" "<<cnt;
}

#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <stdlib.h>

using namespace std;

#define ui unsigned int
#define ll long long
#define ull unsigned long long
#define lb long double
#define fu(i, a, b) for(ui i = a; i <= b; ++i)
#define fuu(i, a, b, x) for(ui i = a; i <= b; i += x)
#define fd(i, a, b) for(long i = a; i >= b; --i)
#define fdd(i, a, b, x) for(long i = a; i >= b; i -= x)
#define N 300

int max(int a, int b) {
	if (a > b) return a;
	return b;
}

char a[N];
int n, check, curr, s, e, o;
int v, s2;

int main() {
	#ifndef ONLINE_JUDGE
		freopen("Test.inp", "r", stdin);
		freopen("Test.out", "w", stdout);
	#endif
	scanf("%d\n", &n);
	fu(i, 1, n) scanf("%c", &a[i]);
	if ((a[1] > 96 && a[1] < 123) || (a[1] > 64 && a[1] < 91)) {
		++n;
		fd(i, n, 2) {
			a[i] = a[i-1];
		}
		a[1] = '_';
	}
	if ((a[n] >= 97 && a[n] <= 122) || (a[n] >= 65 && a[n] <= 90)) {
		++n;
		a[n] = '_';
	}
	fu(i, 1, n) {
		if (a[i] == '(') {
			o = 1;
			s2 = i;
		}
		if (a[i] == ')') {
			o = 0;
			s = i;
			if (i - s2 > 1) ++v;
		}
		if (o && a[i] == '_') {
			if(i - s2 > 1) ++v;
			s2 = i;
		}
		if ((!o && a[i] == '_') || a[i] == '(' || a[i] == ')') {
			if (!check) {
				check = 1;
				s = i;
			}
			else {
				e = i - 1;
				curr = max(curr, e - s);
				s = i;
			}
		}
	}
	printf("%d %d", curr, v);
	return 0;
}

#include <iostream>

using namespace std;

int main()
{int i,no,mx=0,count=0;
string s;
cin>>no;
cin>>s;
no=s.size();
for(i=0;i<no;i++)
{
    if(s[i]=='(')
        {mx=max(count,mx);
            count=0;
        while(s[i]!=')')
        i++;}

  else if(s[i]=='_')
        {mx=max(count,mx);
    count=0;}
    else
         count++;
}
cout<<max(mx,count)<<" ";
count=0;
for(i=0;i<no;i++)
{
   if(s[i]=='(')
        while(s[i]!=')')
    {
      if((s[i]=='_'&&s[i-1]!='_'&&s[i-1]!='(')||(s[i+1]==')'&&s[i]!='_'&&s[i]!='('))
         count++;
      i++;
    }

}

cout<<count;

    return 0;
}

#include <bits/stdc++.h>
#define LL "%I64d"
#define pb push_back
#define pp pop_back
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define pss pair<string, string>
#define psi pair<string, int>
#define psll pair<string, ll>
#define vi vector<int>
#define vs vector<string>
#define vl vector<ll>
#define vc vector<char>
#define vv <vector<vector> >
#define mp make_pair
#define str(a, b) substr((a), (b))
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define endl "\n"
#define sz size()
#define rr return
#define r0 return 0
#define mi map<int>
#define ms map<string>
#define ml map<ll>
#define all_sum(a,b) accumulate((a),(b),0)
using namespace std;
void adskiy_razgon(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
const int mxN=  1e+9+7;
const ll INF = 1e+18+7;
ll nod(ll a, ll b) {
    if(b > a) {
		swap(a, b);
	}
    while(b > 0) {
	    a %= b;
		swap(a, b);
    }
	return a;
}
ll nok(ll a,ll b) {
    return a * b / nod(a, b);
}
void sp(ll a,double b) {
    cout << fixed << setprecision(a) << b;
}
ll binpow (ll a, ll n) {
	if (n == 0) {
		return 1;
	}
	if (n % 2 == 1) {
		return binpow (a, n - 1) * a;
	}
	else {
	    ll b = binpow (a, n / 2);
		return b * b;
	}
}

void solve() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int ans = 0, mx = 0;
	int x = -1;
	for(int i = 0; i < n; ++i) {
		if(s[i] == '(') {
			string k = "";
			i++;
			while(s[i] != ')') {
				if(s[i] == '_') {
					if(k.sz != 0) {
						ans++;
					}
					k = "";
				}
				else {
					k += s[i];
				}
				i++;
			}
			if(k.sz != 0) {
				ans++;
			}
		}
		else if(s[i] != '_' && s[i] != ')' && s[i] != '(') {
			string k = "";
			while(s[i] != '_' && s[i] != '(' && s[i] != ')' && i < n) {
				k += s[i];
				if(s[i + 1] == '_' || s[i + 1] == '(' || s[i + 1] == ')') {
					break;
				}
				i++;
			}
			x = k.sz;
			mx = max(mx, x);
		}
	}
	cout << mx << " " << ans;
}
int main(){
	adskiy_razgon();
	ll t = 1;
	//cin >> t;
	for(int i = 1; i <= t; ++i) {
		//cout << "Case #" << i << ": ";
		solve();
	}
	r0;
}

/** coder Mohammad Al-Hussein *_^ */
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define mp make_pair
#define All(v) v.begin(),v.end()
#define mod  1000000007
#define write freopen("output.txt","w",stdout)
#define read freopen("test (1).txt","r",stdin)
#define FIO std::ios_base::sync_with_stdio(false);
using namespace std;

int main()
{
    int n;
    cin >> n;
    int in = 0,sum = 0,mx = 0,len = 0;
    string s;
    cin >> s;

    for(int i=0; i<n; i++)
    {
        if(s[i] == '(')
        {
            in = 1;
            mx = max(len,mx);
            len = 0;
            continue;
        }
        if(s[i] == ')')
        {
            in = 0;
            sum += (len != 0);
            len = 0;
            continue;
        }

        if(in)
        {
            if(isalpha(s[i])) len++;
            else sum += (len != 0),len = 0;
        }
        else if(in == 0)
        {
            len = (isalpha(s[i]) ? len+1:0);
            mx = max(len,mx);
        }
    }

    cout << mx << " " << sum << endl;

    return 0;
}

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N =1e5+5;
vector< double >v;
bool prime[N+1];
void pre()
{
    memset(prime, true, sizeof(prime));
    prime[0] = prime[1] = 0;

    for (int p=2; p*p<=N; p++)
    {
        if (prime[p] == true)
        {
           for (int i=p*2; i<=N; i += p)
           prime[i] = false;
        }
    }
}
int main()
{
    ios_base ::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n=1,m,x=0,y,cnt=0,flag=0,ans=0,sum=0,maxi=0;
    string a,b,c="";
    cin>>n>>a;
    set<char>s;
    for(int i=0;i<a.length();i++)
    {
        if(a[i]=='(')
        {
            cnt=1;
            ans=0;
        }
        else if(a[i]==')'&&cnt==1)
        cnt=0;
        else if(((a[i]>=65&&a[i]<='Z')||(a[i]>=97&&a[i]<=122))&&cnt==0)
        ans++;
        else
        ans=0;
        maxi=max(maxi,ans);
    }
    ans=0;
    cnt=0;
    for(int i=0;i<a.length();i++)
    {
        if(cnt==0)
        ans=0;
        if(a[i]=='(')
        {
            cnt=1;
            ans=0;
        }
        if(a[i]==')')
        {
            if(ans)
            sum++;
            ans=0;
            cnt=0;
        }
        if((a[i]>='a'&&a[i]<='z')||(a[i]>='A'&&a[i]<='Z')&&cnt==1)
        ans=1;
        if((a[i]=='_')&&(cnt==1))
        {
            if(ans)
            sum++;
            ans=0;
        }
    }
    flag=0;
    y=0;
   ll flag2=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]=='(')
        {
            if(i==0)
            flag=1;
            x++;
        }
        if(a[i]==')')
        {
            if(i==n-1)
            flag2=1;
            y++;
        }
    }
    if(x==1&&flag&&y==1&flag2)
    maxi=0;
    //cout<<maxi<<endl;
     cout<<max(0LL,maxi)<<" "<<max(0LL,sum);
return 0;
}

#include<iostream>

using namespace std;

int main(){

   int tamano;
   string cadena;
   cin>>tamano;
   cin>>cadena;
   int longword=0;
   int word=0;
   int cont=0;
   int posi=0;
   int posf=0;

   bool parentesis=false;

   for(int i=0;i<tamano;i++){
        if(cadena[i]=='('){
            parentesis=true;
           }
        if(cadena[i]==')'){
                if(cadena[i]==')'&&(cadena[i-1]!='_'&&cadena[i-1]!='(')){
                    word++;
                }
            parentesis=false;
        }
        if(parentesis==true){
            if(cadena[i]=='_' &&(cadena[i-1]!='_' &&cadena[i-1]!='(')){
                word++;
               }

        }
        if(parentesis==false && (cadena[i]!='_'&& cadena[i]!='(' && cadena[i]!=')')){
            cont++;
            //cout<<i<<" = "<<cont<<endl;
            if(cont>longword){
                longword=cont;
            }
        }
        if(cadena[i]=='_'|| cadena[i]=='(' || cadena[i]==')'){
            cont=0;
            //cout<<"cont = 0"<<endl;
        }

   }
   cout<<longword<<"  "<<word;

}

#include<iostream>
#define maxslen 256
using namespace std;

char s[maxslen];
int slen,maxlen = 0,word_num = 0;

void input(){
    char c;
    int i;
    cin>>slen;
    for (i = 0; i < slen; i++){
        do{
            c = getchar();
        }while(c == '\n');
        //cout<<i<<' '<<c<<endl;
        s[i] = c;
    }
}

void IsHaveWord(int flag_inKH,int& wordlen){
    if (wordlen > 0){
        if (flag_inKH) word_num++;
        else maxlen = max(maxlen,wordlen);
        wordlen = 0;
    }
}

void solve(){
    bool flag_inKH = false;
    int wordlen = 0;
    int i;
    for (i = 0; i < slen; i++){
        //cout<<s[i];
        switch(s[i]){
        case '(':
            IsHaveWord(flag_inKH,wordlen);
            flag_inKH = true;
            break;
        case ')':
            IsHaveWord(flag_inKH,wordlen);
            flag_inKH = false;
            break;
        case '_':
            IsHaveWord(flag_inKH,wordlen);
            break;
        default:
            wordlen++;
            break;
        }
    }
    IsHaveWord(flag_inKH,wordlen);
}

void output(){
    cout<<maxlen<<' '<<word_num<<endl;
}

int main(){
    input();
    solve();
    output();
}

#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <cassert>
#include <queue>
#include <vector>
#include <utility>
#include <malloc.h>
#include <cstdint>

const unsigned size = 2e5;

int main() {

	unsigned len, wordInBrackets = 0,wordLenOutBrackets=0,temp1;
	char str[256];
	std::cin >> len >> str;

	bool inBrackets = false;

	const char *p = str;
	while (*p) {
		switch (*p){
			case('_') : {
							++p;
							break;
			}
			case('(') : {
							++p;
							inBrackets = true;
							break;
			}
			case(')') : {
							++p;
							inBrackets = false;
							break;
			}

			default: {

				if (inBrackets) {
					wordInBrackets++;

					while (isalpha(*p)) {
						++p;
					}

				}
				else {
					temp1 = 0;

					while (isalpha(*p)) {
						++p;
						++temp1;
					}

					if (temp1 > wordLenOutBrackets) {
						wordLenOutBrackets = temp1;
					}
				}
			}

			break;
		}

	}

	std::cout << wordLenOutBrackets << " " << wordInBrackets;

	return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define pb push_back

#define fr(i,a,b)   for(i=a;i<=b;i++)
#define frn(i,a,b)  for(i=a;i>=b;i--)
#define mem(arr,val)    memset(arr,val,sizeof(arr))
#define mp make_pair
#define pii pair<int,int>
#define F first
#define S second
#define sz(x) (int)(x).size()

int brack[300],i,j,word,mx=0,n,k,sz;
string s;

int main()
{
    //freopen("d://i.txt","r",stdin);
    //freopen("d://o.txt","w",stdout);
    cin>>n>>s;

    sz=sz(s);
    //cout<<sz<<endl;

    for(i=0; i<sz; i=j)
    {
        j=i;
        int cnt=1,con=0;

        if(s[i]=='(')
        {
            j=j+1;
            while(j<sz && s[j]!=')')
            {
                if(s[j]!='_')
                    con++;
                else
                {
                    if(con)
                        word++;

                    con=0;
                }

                j++,cnt++;
            }

            if(con)
                word++;

            // j++;
            // cnt++;

            brack[i]=cnt;
        }
        else
        {
            j++ ;
            continue;
        }
    }

    int con=0;

//fr(i,0,sz-1)
    //   cout<<i<<" "<<brack[i]<<endl;
    if(s[0]=='(')
        i=brack[0]+1;
    else
        i=0;

    for(; i<sz; i+=brack[i]+1)
    {
        //cout<<s[i]<<" ";

        if(s[i]!='_' && s[i]!='(')
            con++;
        else
        {
            mx=max(mx,con);
            con=0;
        }

    }

    mx=max(mx,con);

    cout<<mx<<" "<<word<<endl;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define pb push_back

#define fr(i,a,b)   for(i=a;i<=b;i++)
#define frn(i,a,b)  for(i=a;i>=b;i--)
#define mem(arr,val)    memset(arr,val,sizeof(arr))
#define mp make_pair
#define pii pair<int,int>
#define F first
#define S second
#define sz(x) (int)(x).size()

int i,j,word,mx=0,n,k,sz,cnt1=0;
string s;

int main()
{
    //freopen("d://i.txt","r",stdin);
    //freopen("d://o.txt","w",stdout);
    cin>>n>>s;

    sz=sz(s);
    //cout<<sz<<endl;
    bool fl1=0,fl2=0;

    int con=0;

    for(i=0; i<sz; i++)
    {
        if(s[i]=='(')
        {
            fl1=1;
            continue;
        }

        if(fl1)
        {
            if(isalpha(s[i]))
                cnt1++;
            else
            {
                if(cnt1)
                    word++;

                cnt1=0;
            }

        }

        if(s[i]==')')
        {
            fl1=0;
        }
    }

    size_t found;

    fr(i,0,sz-1)
    {
        if(isalpha(s[i]))
            con++;
        else
        {
            mx=max(con,mx);
            con=0;
        }

        if(s[i]=='(')
        {
            found=s.find(')',i+1);
            i=found;
        }
    }

    mx=max(mx,con);

    cout<<mx<<" "<<word<<endl;

    return 0;
}

#include <iostream>
#include <sstream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <utility>

//#include "segment_tree.h"
//#include "fenwick_tree.h"
//#include "union_find.h"
//#include "geometry.h"
using namespace std;

#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define DOW(i,a,b) for(int i = (a); i >= (b); i--)
#define REP(i,a) for(int i=0,_a=(a); i<_a; ++i)
#define FORI(it, x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define RESET(c,val) memset(c,val,sizeof(c))

#define ALL(x) x.begin(), x.end()
#define UNIQUE(c) (c).resize(unique(ALL(c)) - (c).begin())

#define sz(a) int(a.size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second

// bitmask
#define isOn(S, j) (S & (1 << j))
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define lowBit(S) (S & (-S))
#define setAll(S, n) (S = (1 << n) - 1)

// other manipulation
#define modulo(S, N) ((S) & (N - 1)) // return S % N, where N = 2^k
#define isPowerOfTwo(S) (!(S & (S - 1))
#define nearestPowerOfTwo(S) ((int)pow(2.0, (int)((log((double)S) / log(2.0)) + 0.5)))
#define turnOffLastBit(S) ((S) & (S-1))
#define turnOnLastZero(S) ((S) | (S+1))
#define turnOffLastConsecutiveBits(S) ((S) & (S + 1))
#define turnOnLastConsecutiveZeroes(S) ((S) & (S - 1))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

/*---------------------------*/

using namespace std;

int main()
{
	int n;
	cin >> n;
	string S;
    cin >> S;
	int countIn= 0, countLong= 0, countParen= 0, longMax= 0;
	for(int i= 0; i < n; i++)
	{
		switch (S[i])
		{
			case '(':
				if( countLong && !countParen && countLong > longMax ) longMax= countLong;
                countLong= 0;
				countParen++;
				break;
			case ')':
				countParen--;
				if( countLong )
                {
                    countIn++;
                    countLong= 0;
                }
				break;
			default:
				if( S[i] >= 'a' && S[i] <= 'z' || S[i] >= 'A' && S[i] <= 'Z' )
                    countLong++;
                else
                {
                    if( countParen && countLong )
                        countIn++;
                    else
                        if( countLong > longMax ) longMax= countLong;
                    countLong= 0;
                }
		}
	}

    if( countLong > longMax ) longMax= countLong;

    cout << longMax << " " << countIn ;
}

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <ctime>
#define fur(i,a,b) for(int i=(a);i<=(b);i++)
#define furr(i,a,b) for(int i=(a);i>=(b);i--)
#define cl(a) memset((a),0,sizeof(a))
#ifdef HandsomeHow
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define dbg(x) cerr << #x << " = " << x << endl
#else
#define debug(...)
#define dbg(x)
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
const int inf=0x3f3f3f3f;
const double eps=1e-8;
const int mod=1000000007;
const double pi=acos(-1.0);
inline void gn(long long&x){
    int sg=1;char c;while(((c=getchar())<'0'||c>'9')&&c!='-');c=='-'?(sg=-1,x=0):(x=c-'0');
    while((c=getchar())>='0'&&c<='9')x=x*10+c-'0';x*=sg;
}
inline void gn(int&x){long long t;gn(t);x=t;}
inline void gn(unsigned long long&x){long long t;gn(t);x=t;}
ll gcd(ll a,ll b){return a? gcd(b%a,a):b;}
ll powmod(ll a,ll x,ll mod){ll t=1ll;while(x){if(x&1)t=t*a%mod;a=a*a%mod;x>>=1;}return t;}
// (づ°ω°)づe★-------------------------------------------------
int len;
string s;
int main(){
#ifdef HandsomeHow
    freopen("data.in","r",stdin);
    //freopen("data.out","w",stdout);
    time_t beginttt = clock();
#endif
	int tp = 1;//1括号外2括号内
	cin>>len>>s;
	s="_"+s+"_";
	int in = 0,out = 0;
	len=s.length();
	int cnt = 0;
	for(int i = 1; i < len; ++i){
		if(s[i]=='(') {
			out=max(out,cnt);
			cnt=0;
			tp=2;
			continue;
		}
		if(s[i]==')'){
			out=max(out,cnt);
			cnt=0;
			tp=1;
			continue;
		}
		if(tp==2) continue;
		if(s[i]=='_'){
			out=max(out,cnt);
			cnt=0;
		}
		else cnt++;
	}

	tp=1;
	for(int i = 1; i <len; ++i){
		if(s[i]=='('){
			tp=2;
			continue;
		}
		if(s[i]==')'){
			tp=1;
			if((s[i-1]>='a' && s[i-1]<='z') || (s[i-1]>='A' && s[i-1]<='Z')){
				//printf("%c\n",s[i-1]);
				in++;
			}
			continue;
		}
		if(tp==1) continue;
		if(s[i]=='_'){
			if((s[i-1]>='a' && s[i-1]<='z') || (s[i-1]>='A' && s[i-1]<='Z')){
				//printf("%c\n",s[i-1]);
				in++;
			}

		}
	}
	cout<<out<<" "<<in<<endl;
#ifdef HandsomeHow
	time_t endttt = clock();
    debug("time: %d\n",(int)(endttt - beginttt));
#endif
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
   int n;
   string str;
   cin>>n>>str;
   int start1=-1, start2=-1, i=0, j=0, count=0;
   vector<string> inside;
   string token;
   while(i>=0)
   {
      i=str.find('(');
      j=str.find(')');
      if(i<0 || j<0)
         break;
      string sub = str.substr(i+1, j-i-1);
      str.replace(i, j-i+1, "_");
      inside.push_back(sub);
      i=str.find('(');
     /* if(i<0)
         break;*/
   }

   for(int i=0; i<inside.size(); i++)
         {
            if(inside[i].length()>0)
               {
                  istringstream iss(inside[i]);
                   while (getline(iss, token, '_'))
                     {
                        if(token.length()>0)
                        count++;
                      }
               }
         }
    vector<string> v;
    int pos=0;
    int x=str.find('_');
    while ((pos = str.find("_")) != string::npos)
      {
          token = str.substr(0, pos);
         // if(token.length()>0)
            v.push_back(token);
          str.erase(0, pos+1);
      }
   v.push_back(str);
   int maxsize=0;
   if(v.size()==0 && x<0)
      maxsize=str.size();
   else
   {
      for(int i=0; i<v.size(); i++)
      {
         if(maxsize<v[i].length())
            maxsize = v[i].length();
      }
   }
   cout<<maxsize<<" "<<count<<endl;
   return 0;
   }

#include<iostream>
#include<math.h>
#include<string>
using namespace std;
void main()
{
	int n,counter=0,max=0,in=0;
	cin>>n;
	char s[260];
	for(int i=0;i<n;i++)
		cin>>s[i];
	s[n]='\0';
	for(int i=0;i<n;i++)
	{

		if(s[i]!='(')
		{
			if(s[i]!='_')
			{
				counter++;
				if(counter>max)
					max=counter;
			}
			else
				counter=0;
		}
		else
		{
			counter=0;
			while(s[i]!=')')
			{
				i++;
				int t=0;
				while(s[i]!='_'&&s[i]!=')')
				{
					i++;
					t++;
				}
				if(t!=0)
				in++;
			}
		}
	}
	cout<<max<<" "<<in;

	return ;
}

#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <vector>
using namespace std;
typedef long long ll;
typedef long double ld;
#define mp(x,y) make_pair(x,y)
#define r0 return 0;
int main(){
	string s;
	ll n,lm=0,sk=0;
	cin>>n;
	cin>>s;
	ll l=s.length();
	ll curl=0;
	bool sl=0;
	bool so=0;
	for (int i=0; i<l; i++){
		if (s[i]!='_'&&s[i]!='('&&s[i]!=')'){
			sl=1;
		}
		if (so){
			if (s[i]=='_'||s[i]=='('||s[i]==')'){
				if (sl){
					sl=0;
					sk++;
					if (s[i]==')') so=0;
				}
			}
		}
		if (s[i]==')') so=0;
		else if (s[i]=='_'||s[i]=='('||s[i]==')') {
			sl=0;
		}
		if (sl){
			if (!so)
				curl++;
		}
		else {
			curl=0;
		}
		lm=max(curl,lm);
		if (s[i]=='(') so=1;
	}
	cout<<lm<<" "<<sk;
}
/*37
_a_(_b___c)__de_f(g_)__h__i(j_k_l)m__*/

#include<bits/stdc++.h>

using namespace std;

#define sci(x) scanf("%d",&x)

#define scs(arr) scanf("%s",arr)
#define pfi2(x,y) printf("%d %d\n",x,y)

#define sz 10000

char arr[sz];
int main()
{
    bool key;
    int i,j,n,m,tc,cont,length;
    sci(n);
    scs(arr);
    cont=0,length=0;

    for(i=0; i<n; i++)
    {
        if(arr[i]=='(')
            for(j=i+1,key=true; j<n; j++)
            {
                if(isalpha(arr[j]) and key)
                {
                    cont++;
                    key=false;
                }
                else if(arr[j]=='_')
                {
                    key=true;
                    continue;
                }

                else if(arr[j]==')')
                {
                    i=j;
                    break;
                }
            }
    }
    for(i=0; i<n; i++)
    {
        if(arr[i]=='(')
        {
            for(j=i; j<n; j++,i++)
            {
                if(arr[j]==')')
                {
                    i=j;
                    break;
                }
            }
            i=j;
        }
        else
        {
            for(j=i,tc=0; j<n; j++)
            {
                if(isalpha(arr[j]))
                    tc++;
                if(arr[j]=='_')
                {
                    length=max(length,tc);
                    tc=0;
                }
                if(arr[j]=='(')
                {
                    length=max(length,tc);
                    tc=0;
                    i=--j;
                    break;
                }
            }
            i=j;
            length=max(length,tc);
        }
    }
    pfi2(length,cont);
    return 0;
}

#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
using namespace std;
char s[500];
int main()
{
	int n;
	scanf("%d",&n);
	scanf("%s",s);
	int len=strlen(s);
	int flag=0,max=0,cnt=0,l=0;
	int f=0;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='(')
		{
			flag=1;
			continue;
		}
		if(s[i]==')')
			{
				flag=0;
				continue;
			}
		if(flag==1)
			{
				while(('a'<=s[i]&&s[i]<='z')||('A'<=s[i]&&s[i]<='Z'))
				{
					f=1;
					i++;
				}
				if(f==1)
				{
					i--;
					cnt++;
					f=0;
				}
			}
			while(flag==0&&('a'<=s[i]&&s[i]<='z')||('A'<=s[i]&&s[i]<='Z'))
			{
					l++;
					i++;
					f=1;
			}
			if(max<l)
			max=l;
			if(f==1)
			{
				i--;
				f=0;
			}

			l=0;
	}
	if(max<l)
	max=l;
	printf("%d %d\n",max,cnt);
 }

#include <bits/stdc++.h>
using namespace std;

#define pb push_back

int main() {
	//freopen("input.txt","r",stdin);
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	char ch;
	vector<string> word;
	vector<string> wordInside;
	int Max = 0;
	string tmp = "";
	bool insideParentheses = false;
	for(int i=0;i<n;i++){
	    cin >> ch;
		if(ch=='('){
			if(tmp.size()>0) word.pb(tmp);
			insideParentheses = true;
			tmp = "";
		}
		else if(ch==')'){
			insideParentheses = false;
			if(tmp.size()>0) wordInside.pb(tmp);
			tmp="";
		}
		else if(ch == '_'){
			if(insideParentheses){
				if(tmp.size()>0) wordInside.pb(tmp);
				tmp = "";
				continue;
			}
			else{
			    if(tmp.size()>0) word.pb(tmp);
			    tmp="";
			}
		}
		else if(isalpha(ch)){
			tmp+=ch;
			if(i==n-1){
			    word.pb(tmp);
			}
		}
	}
	for(int i=0;i<word.size();i++){
		if(word[i].size()>Max) Max = word[i].size();
	}
	cout << Max << " " << wordInside.size();
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,k,l,m,n,a,b,c;
    string str;
    vector <char> in_braket,out_braket;
    while(cin>>n)
    {
        bool braket = false;
        cin>>str;
        for(i=0;i<str.size();i++)
        {
            if(str[i]=='(')
                braket=true;
            else if(str[i]==')')
            {
                braket=false;
                in_braket.push_back(str[i]);
            }
            if(braket)
                in_braket.push_back(str[i]);
            else
                out_braket.push_back(str[i]);
        }
        /*for(i=0;i<in_braket.size();i++)
            cout<<in_braket[i];
        cout<<endl;*/
        bool found = false;
        int cnt = 0;
        char ch;
        for(i=0;i<in_braket.size();i++)
        {
            if((in_braket[i]>='A' && in_braket[i]<='Z')|| (in_braket[i]>='a' && in_braket[i]<='z'))
            {
                ch=in_braket[i];
                //cout<<"found "<<ch<<endl;
                found=true;
            }
            if(found && (in_braket[i]=='_' || in_braket[i]==')'))
            {

                cnt++;
                found=false;
                //cout<<"coount : "<<ch<<endl;
            }
        }
        //cout<<cnt<<endl;
        in_braket.clear();
        int len=0,max_len=0;
        /*for(i=0;i<out_braket.size();i++)
            cout<<out_braket[i];
        cout<<endl;*/
        for(i=0;i<out_braket.size();i++)
        {
            if((out_braket[i]>='A' && out_braket[i]<='Z')|| (out_braket[i]>='a' && out_braket[i]<='z'))
            {
                len++;

            }
            if(out_braket[i]=='_' || i==out_braket.size()-1 || out_braket[i]==')')
            {
                max_len = max(len,max_len);
                len=0;
            }

        }
        //cout<<max_len<<endl;
        out_braket.clear();
        cout<<max_len<<" "<<cnt<<endl;
    }
    return 0;
}

#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	if(n==0)
	{
		cout<<"0 0\n";
		return 0;
	}
	string s;
	cin>>s;
	int l=s.length();
	string temp="";
	int max=-1,y=0;
	for (int i = 0; i < n; ++i)
	{
		if(s[i]=='(')
		{
			y=temp.length();
			if(y>max)
				max=y;
			temp="";
			while(s[i]!=')')
				i++;
			// i++;
			continue;
		}
		if(s[i]!='_')
		{
			temp=temp+s[i];
		}
		if(s[i]=='_' || i==l-1)
		{
			int y=temp.length();
			if(y>max)
				max=y;
			temp="";
		}
		/* code */
	}
	int count=0,flag=0;
	temp="";
	for (int i = 0; i < n; ++i)
	{
		if(s[i]=='(')
		{
			flag=1;
			continue;
		}
		if(s[i]==')')
		{
			if(temp.length()>0)
					count++;
			temp="";
			flag=0;
			continue;
		}

		if(flag==1)
		{
			if(s[i]!='_')
			{
				temp+=s[i];
			}
			else
			{
				if(temp.length()>0)
					count++;
				temp="";
			}
		}
		/* code */
	}
	cout<<max<<" "<<count<<endl;
	return 0;
}

#include <iostream>
#include <string>

using namespace std;

int main() {
	short s_len, cur_len = 0, max_len = 0, in_par_count = 0;
	bool flag = false;
	string s;
	cin >> s_len >> s;

	s_len--;

	for (int i = 0; i <= s_len;) {
		flag = false;
		cur_len = 0;

		if (s[i] == ')')
			i++;
		else if (s[i] == '_') {
			max_len < cur_len ? max_len = cur_len : NULL;
			i++;
		}
		else if (s[i] == '(') {
			i++;
			while (s[i] != ')') {
				flag = false;

				if (s[i] != '_') {
					while (s[i] != '_' && s[i] != ')' && i <= s_len) {
						flag = true;
						i++;
					}

					if(flag) in_par_count++;
					flag = false;
				} else
					i++;
			}
		}
		else {
			while (s[i] != '_' && s[i] != '(' && i <= s_len) {
				cur_len++;
				i++;
			}

			max_len < cur_len ? max_len = cur_len : NULL;
		}
	}

	cout << max_len << ' ' << in_par_count << endl;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,tem,tmp,ans;
bool word,kaishi;
char c;
int main(){
	scanf("%d",&n);
	scanf("\n");
	tem=0;
	kaishi=false;
	ans=0;
	tmp=0;
	word=0;
	for(int i=1;i<=n;i++){
		scanf("%c",&c);
		if(c=='('){
			kaishi=true;
			ans=max(ans,tem);
			tem=0;
		}
		if(c==')'){
			kaishi=false;
			if(word)
				tmp++;
				word=false;
		}
		if(kaishi){
			if((c>='A'&&c<='Z')||(c>='a'&&c<='z'))
				word=true;
			if(c=='_'){
				if(word){
					tmp++;
					word=false;
				}
			}
		}
		if(!kaishi){
			if(c=='_'||c==')'||c=='('){
				ans=max(tem,ans);
				tem=0;
			}
			if((c>='A'&&c<='Z')||(c>='a'&&c<='z'))
				tem++;
		}
	}
	if(tem!=0)
		 ans=max(ans,tem);
	printf("%d %d",ans,tmp);
	return 0;
}

#include <iostream>
#include <string>

using namespace std;

int main() {
	short s_len, cur_len = 0, max_len = 0, in_par_count = 0;
	string s;
	cin >> s_len >> s;

	s_len--;

	for (int i = 0; i <= s_len;) {
		cur_len = 0;

		if (s[i] == ')')
			i++;
		else if (s[i] == '_') {
			max_len < cur_len ? max_len = cur_len : NULL;
			i++;
		}
		else if (s[i] == '(') {
			i++;
			while (s[i] != ')') {
				if (s[i] != '_') {
					while (s[i] != '_' && s[i] != ')' && i <= s_len) {
						i++;
					}

					in_par_count++;
				} else
					i++;
			}
		}
		else {
			while (s[i] != '_' && s[i] != '(' && i <= s_len) {
				cur_len++;
				i++;
			}

			max_len < cur_len ? max_len = cur_len : NULL;
		}
	}

	cout << max_len << ' ' << in_par_count << endl;
}

#include <cstdio>
#include <cstring>
#include <cctype>
#include <cmath>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <utility>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <set>
#define fr(a) freopen(a,"r",stdin)
#define fw(a) freopen(a,"w",stdout)
#define reset(a) memset(a,0,sizeof(a))
#define all(a) a.begin(),a.end()
#define pb push_back
#define ins insert
#define mp make_pair
#define fi first
#define se second
#define bug(x) cout << #x << " = " << x << endl;
using namespace std;
typedef long long int ll;
typedef unsigned long long int llu;
typedef long double lf;
typedef pair<int,int>pii;
typedef pair<ll,ll>pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

int main(){
    string s;
    int t1=0,t2=0,i,j,temp,n;
    cin>>n>>s;
    s+='_';
    //cout<<s[6]<<" "<<s[7]<<endl;
    for(i=0;i<n;i++){
        if(s[i]=='('){
            j=i;
            while(s[j]!=')'&&j<n){
                if((s[j]=='_'||s[j]=='(')&&(s[j+1]!='_'&&s[j+1]!=')')) t2++;
                //cout<<j<<" "<<t2<<endl;
                j++;
            }
            i=j;
        }
        else{
            temp=0;
            j=i;
            while(s[j]!='('&&j<n){
                if(s[j]!='_') temp++;
                //cout<<j<<" "<<temp<<endl;
                if(s[j]=='_'||j+1==n||s[j+1]=='(') t1=max(t1,temp),temp=0;
                j++;
            }
            i=--j;
        }
    }
    cout<<t1<<" "<<t2<<endl;
    return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int n,ans1,ans2,tmp;
string s;
bool a,b;
int main(){
	cin>>n;
	cin>>s;
	s=s+'_';
	for (int i=0;i<s.length();i++){
		if (s[i]=='(') {
			a=1;
			ans1=max(ans1,tmp);
			tmp=0;
		} else if (s[i]==')') {
			a=0;
			tmp=0;
			if ((s[i-1]!='_')&&(s[i-1]!='(')) ans2++;
		} else if (s[i]=='_'){
			if (a==1){
				if ((s[i-1]!='_')&&(s[i-1]!='(')) ans2++;
				tmp=0;
			}else{
				ans1=max(ans1,tmp);
				tmp=0;
			}
		} else {
			tmp++;
		}
	}
	printf("%d %d",ans1,ans2);
	return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	int n;
	cin>>n;
	vector<char> arr;
	arr.resize(n);

	for(int i=0;i<n;i++){
		cin>>arr[i];

	}
	bool major=false;
	int last_loc=0;
	int par_loc=0;
	vector <int> sizes;
	int words=0;
	int s=0;

  if(arr[0]!='_' && arr[0]!='('){
    last_loc=-1;
  }
	for(int i=0;i<n;i++){
		if(major){

			if(arr[i]=='_' && arr[i-1]!='_' && arr[i-1]!='('){

				words++;
				par_loc=i;

    }

    if(arr[i]=='_'){
      par_loc=i;
    }

				if(arr[i]==')'){
          last_loc=i;
					if((par_loc+1)!=i){
						words++;
					}
					major=false;

			}

		}
		else{
		if(arr[i]=='('){
			major=true;

		}

		if(((arr[i]=='_' || arr[i]==')'  || arr[i]=='(')  && i!=last_loc+1 && i!=last_loc) || (i==(n-1))){
      if(i==(n-1)){
    //fuck
    if(((arr[i]=='_' || arr[i]==')'  || arr[i]=='(')  && i!=last_loc+1 && i!=last_loc)){

    }
    else{
    i+=1;
  }
    }
			if((i-last_loc+1)!=0){
			sizes.push_back(i-last_loc-1);
			}
			else{
				sizes.push_back(1);
			}
			s++;
      last_loc=i;
		}
    if(arr[i]=='('){
      last_loc=i;
      par_loc=i;
    }
    if(arr[i]=='_'){
      last_loc=i;
    }
		}

	}
	sizes.resize(s);
	sort(sizes.begin(),sizes.end());
	reverse(sizes.begin(),sizes.end());

	cout<<((s==0)?0:sizes[0])<<" "<<words;
	return 0;

}

#include <iostream>

using namespace std;

int max(int, int);

int main(){
	//ji
	int n,len=0, maxlen=0, words=0;
	char c;
	bool paren=0,aux=0;
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> c;
		if(c == '_'){
			if(!paren) maxlen = max(maxlen,len);
			len = 0;
			if(paren && aux) words++;
			aux=0;
		}else if(c == '('){
			maxlen = max(maxlen,len);
			len = 0;
			paren = 1;
		}else if(c == ')'){
			if(aux) words++;
			paren = 0;
			aux=0;
			len = 0;
		}else{
			len++;
			if(paren) aux=1;
		}
		//cout << c  << " " << maxlen << endl;
	}
	maxlen = max(maxlen,len);
	cout << maxlen << " " << words << endl;

	return 0;
}

int max(int a, int b){
	if(a>b)
		return a;
	return b;
}

#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <time.h>
#include <sstream>
#include <fstream>
#include <algorithm>
#include <map>

using namespace std;
/*
ifstream in("D:/opener/42in.txt");
ofstream out("D:/opener/42out.txt");
#define cin in
#define cout out
*/
int main()
{
	string s;
	cin >> s;
	cin >> s;
	int mx1 = 0, mx2 = 0;
	string cur = "";
	bool isIn = false;
	for(int i = 0; i < s.size(); ++i)
	{
		if(s[i] == '_')
		{
			if(cur != "")
				if(isIn)
					++mx2;
				else
					mx1 = max(mx1, int(cur.size()));
			cur = "";
		}
		else
			if(s[i] == '(')
			{
				if(cur != "")
					mx1 = max(mx1, int(cur.size()));
				cur = "", isIn = true;
			}
			else if(s[i] == ')')
			{
				if(cur != "")
					++mx2;
				cur = "", isIn = false;
			}
			else
				cur += s[i];
	}
	if(isIn)
		++mx2;
	else
		mx1 = max(mx1, int(cur.size()));

	cout << mx1 << " " << mx2  << endl;
}

// Example program
#include <iostream>
#include <string>
using namespace std;
int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    int flag=0;
    int count = 0;
    int maxdl = 0;
    int lastr = -1;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='(')
        {
            flag=1;
            if(i-lastr-1>maxdl) maxdl = i-lastr-1;
            lastr=i;
        }
        if(s[i]==')')
        {
            flag=0;
            if(i-lastr>1) count++;
            lastr=i;
        }
        if(s[i]=='_' && flag==1)
        {
            if(i-lastr>1) count++;
            lastr=i;
        }
        if(s[i]=='_' && flag==0)
        {
            if(i-lastr-1>maxdl) maxdl=i-lastr-1;
            lastr=i;
        }
    }
    if(s.size()-lastr-1>maxdl) maxdl=s.size()-lastr-1;
    cout<<maxdl<<" "<<count;
    return 0;
}

#include <iostream>
#include <cstdio>
#include <ctype.h>

using namespace std;
const int maxn = 300;
const int INF = 1e6;

char str[maxn];
int n;

int main()
{
    //freopen("in.txt", "r", stdin);
    while(~scanf("%d", &n)) {
        scanf("%s", str);

        int inside_ = 0, len = 0;

        bool inPar = false;
        bool isWord = false;
        int tmp = 0;
        for(int i = 0; i < n; i++) {
            if(isalpha(str[i])) {
                if(!isWord) isWord = true;
                if(!inPar)  tmp++;
                if(i == n-1 && isWord && !inPar) {
                    len = max(len, tmp);
                    tmp = 0;
                }
            }
            if(!isalpha(str[i])) {
                //printf("not alpha:");
                if(isWord && !inPar) {
                    isWord = false;
                    len = max(len, tmp);
                    tmp = 0;
                    //printf("isWord && !inPar");
                }
                if(isWord && inPar) {
                    isWord = false;
                    inside_++;
                    //printf("isWord && inPar");
                }
                if(str[i] == '(') {
                    inPar = true;
                    //printf("(\n");
                }
                if(str[i] == ')') {
                    inPar = false;
                    //printf(")\n");
                }

            }

        }
        printf("%d %d\n", len, inside_);
    }
    return 0;
}

#include <iostream>
#include<string>
using namespace std;

int main() {
	// your code goes here
	int n,wc=0,bc=0,oc=0,moc=0;string s;bool t=0;
	cin>>n>>s;

	for(int i=0;i<n;i++){
		if((s[i]>64 && s[i]<91) || (s[i]>96 && s[i]<123)) wc++;

		if(s[i]=='_' || s[i]=='(' || s[i]==')' || i==n-1){
			if(t==1 && wc>0) bc++;
			else {if(wc>moc) moc=wc;}
			wc=0;

		}
		if(s[i]=='(') t=1;
		if(s[i]==')') t=0;
		//cout<<"1";
	}

	cout<<moc<<" "<<bc;
	return 0;
}

#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
   /* freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);*/
    int n , k = 0, i, h , j , d = 0 , maxx=-1 , minn=0 ;
    string s , l , q , t;
    cin >> n;
    cin >> s;
   for ( i = 0 ; i < n ;i++)
    {
         if ( i == n - 1)
         {
             if ( s[i] >= 65 && s[i] <= 90)
             {
                 k++;
                 maxx=max(maxx,k);
             }
             if ( s[i] >= 97 && s[i] <= 122)
             {
                k++;
                maxx=max(maxx,k);
             }
         }
           if ( s[i] >= 65 && s[i] <= 90)
             {
                 k++;
             }
             if ( s[i] >= 97 && s[i] <= 122)
             {
                k++;
             }
               if ( s[i]==')')
               {
                    if ( k > 0) {minn++;}
                    d=0;
                    k=0;
               }
               if ( s[i]=='(')
               {
                    d=1;
                    maxx=max(maxx,k);
                    k=0;
               }
       if ( s[i] == '_')
        {
             if ( d == 1)
             {
                  if ( k > 0)
                  minn++;
                  k=0;
             }
             if ( d == 0)
             {
                  if ( k > 0){
                  maxx=max(maxx,k);}
                  k=0;
             }
        }
    //    cout << maxx << " " << i << endl;
    }
    if ( maxx < 0)
    {
         cout << 0 << " " << minn;
    }
    else
    cout << maxx << " " << minn;
}

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<set>
#include<cctype>
#include<map>
using namespace std;

void main()
{
	int x=0,c=0,Max=0,y;
	cin>>y;
	string str;
	vector<char>v1,v2;
	cin>>str;
	for(int i=0;i<str.size();i++){
		if(str[i]=='('){
			x=1;
			v1.push_back('_');
			continue;
		}
		if(str[i]==')'){
			v2.push_back('_');
			x=0;
			continue;
		}
		if(x==0)
			v1.push_back(str[i]);
		else
			v2.push_back(str[i]);
	}
	for(int i=0;i<v1.size();i++){
		if(v1[i]!='_'){
			c++;
		}
		else{

			Max=max(Max,c);
			c=0;
		}
		if((i==(v1.size()-1)&&v1[i]!='_'))
			Max=max(Max,c);

	}
	c=0;
	for(int i=1;i<v2.size();i++){
		if((v2[i]=='_'&&v2[i-1]!='_')||(i==(v2.size()-1)&&v2[i]!='_')){
			c++;
		}

	}
	cout<<Max<<" "<<c;
}

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <fstream>
using namespace std;
int main()
{
    int n;
    string s;
    int count = 0, max = 0;
    cin >> n >> s;
    vector<int> posPar;
    vector<int> posDash1;
    vector<int> posDash2;
    for(int i = 0; i < s.size(); i++)
        if(s[i] == '(' || s[i] == ')')
            posPar.push_back(i);
    string sPar = "";
    string newS = "_";
    if(posPar.size() == 0)
    {
        newS += s;
        newS += "_";
    }
    else
    {
        for(int i = 0; i < posPar.size() - 1; i += 2)
        {
            sPar += s.substr(posPar[i], posPar[i + 1] - posPar[i] + 1);
        }
        newS += s.substr(0, posPar[0] + 1);
        for(int i = 1; i < posPar.size() - 1; i += 2)
        {
            newS += s.substr(posPar[i], posPar[i + 1] - posPar[i] + 1);
        }
        int lastPos = posPar[posPar.size() - 1];
        newS += s.substr(lastPos, s.size() - lastPos);
        newS += "_";
        for(int i = 0; i < sPar.size(); i++)
            if(sPar[i] == '_' || sPar[i] == '(' || sPar[i] == ')')
                posDash2.push_back(i);
        for(int i = 0; i < posDash2.size() - 1; i++)
            if(posDash2[i + 1] - posDash2[i] > 1)
                count++;
    }
    for(int i = 0; i < newS.size(); i++)
        if(newS[i] == '_' || newS[i] == '(' || newS[i] == ')')
            posDash1.push_back(i);
    for(int i = 0; i < posDash1.size() - 1; i++)
        if(max < posDash1[i + 1] - posDash1[i])
            max = posDash1[i + 1] - posDash1[i] - 1;
    cout << max << " " << count;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>

using namespace std;

int main(){
	char c[256];
	int maxlen=0, skk=0,k=0,i,n,pi=-1;
	bool sk=false,p=false;
	cin >>n;
	cin >>c;
    c[n]='_';

	for (i=0;i<=n;i++){
		if(sk) pi=i;
		if ((c[i]=='_')&&(i>pi)){
			if (!sk){if(i-pi-1>maxlen) maxlen=i-pi-1;}
			//if (sk) k++;
			pi=i;
		}
		if (c[i]=='('){
		    if (!sk){if(i-pi-1>maxlen) maxlen=i-pi-1;}
			sk=true;
			int j=i+1;
			while (c[j]!=')'){
				if ((c[j]!='_')&&(c[j]!=')')){k++; while((c[j]!='_')&&(c[j]!=')'))j++;} else j++;
			}
		};
		if (c[i]==')'){
			sk=false;
		}
	}
	i=n-1;
	//while ((c[i]!=')')&&(c[i]!='_')&&(i>=0)){ skk++;i--;};
	cout << max(maxlen,skk)<<' '<<k;

return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
int n;
cin>>n;
string s;int t=0,h=0,i;
cin>>s;int lop=0,nip=0,mlop=INT_MIN;
for(i=0;i<s.length();i++)
{
    if(s[i]=='_')
    {
       if(t==1)
       {
          if(h==1)
          {
             nip++;h=0;
          }
       }else if(t==0)
       {
           if(mlop<lop)
           {
               mlop=lop;
           }
           lop=0;
       }
    }else if(s[i]=='(')
             {
                if(t==0)
                {
            if(mlop<lop)
           {
               mlop=lop;
           }
                    t=1;
                }
             }else if(s[i]==')')
             {
                 if(t==1)
                 {
                     if(h==1)
                     {
                         nip++;h=0;
                     }
                     t=0;lop=0;
                 }
             }else{
             if(t==0)
             {
                 lop++;
             }
             else if(t==1)
             {
                 h=1;
             }
             }
}
cout<<mlop<<" "<<nip;
return 0;
}

            #include<bits/stdc++.h>
            #define ll            long long
            #define pb            push_back
            #define ppb           pop_back
            #define si            set <ll>
            #define endl          '\n'
            #define fr            first
            #define sc            second
            #define mii           map<ll ,ll >
            #define msi           map<string,ll >
            #define mis           map<ll , string>
            #define rep(i,a,b)    for(ll  i=a;i<b;i++)
            #define all(v)        v.begin(),v.end()
            #define sort(v)       sort(all(v))
            #define pii           pair<ll ,ll >
            #define vi            vector<ll >
            #define vii           vector<pair<ll , ll >>
            #define vs            vector<string>
            #define sz(x)         (ll )x.size()
            #define M             1000000007
            #define bs            binary_search
            #define mp            make_pair
            #define sp(n)         setprecision(n)
            #define spl           " "
            #define arr(a,n)      rep(i,0,n) cin>>a[i]
            #define mod           998244353
            #define what_is(x)    cout << #x << " is " << x << endl;
            using namespace std;
            ll modularExponentiation(ll x,ll n,ll mm)
            {
                ll result=1;
                while(n>0)
                {
                    if(n% 2 ==1)
                        result=(result * x)%mm;
                    x=(x*x)%mm;
                    n=n/2;
                }
                return result;
            }
            ll fib(ll n)
            {
              long double phi = (1 + sqrt(5)) / 2;
              return round(pow(phi, n) / sqrt(5));
            }
            vector<bool> prime(100000,true);
            void SieveOfEratosthenes()
            {
                prime[0]=false;
                prime[1]=false;
                for (ll p=2; p*p<=prime.size(); p++)
                {
                    if(prime[p] == true)
                    {
                      for (ll i=p*p; i<=prime.size(); i += p)
                        prime[i] = false;
                    }
                }
            }

            ll min(ll a,ll b)
            {
                return a<b?a:b;
            }

            void solve()
            {
             ll n;
             string s;
             cin>>n;
             cin>>s;
             ll cnt=0;
             rep(i,0,n)
             {
                 if(s[i]=='(')
                 {
                     ll j=i+1;

                     while(j<n && s[j]!=')')
                     {
                         if(s[j]=='_')
                           {
                               if(s[j-1]!='_' && j-1!=i )
                                cnt++;
                           }
                           j++;
                     }
                     if(s[j-1]!='_') cnt++;
                 }
             }
             ll ans=0,c=0;
             rep(i,0,n)
             {
                 if(s[i]=='(')
                 {
                     while(s[i]!=')') i++;
                 }
                 else
                 {
                     if(s[i]!='_')
                     c++;
                     else
                     {
                         ans=max(c,ans);
                         c=0;
                     }
                 }
             }
             cout<<ans<<" "<<cnt;

            }
            signed main()
            {
                ios_base::sync_with_stdio(false);
                cin.tie(0);
                cout.tie(0);
                ll t=1;
                //cin>>t;
                while(t--) solve();
            }

#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long int result=0,word=0,i,temp=0,t=0,large=0,n;
 cin>>n;
    string str;
    cin>>str;
    for(i=0;i<str.length();i++)
    {
        if(str[i]=='(')
        {
            if((str[i+1]>='a'&&str[i+1]<='z')||(str[i+1]>='A'&&str[i+1]<='Z'))
              word++;
            result++;
        }
        if(result>=1)
        {
            if(str[i]=='_'&&((str[i+1]>='a'&&str[i+1]<='z')||(str[i+1]>='A'&&str[i+1]<='Z')))
                word++;
        }
        else
        {
            if((str[i]>='a'&&str[i]<='z')||(str[i]>='A'&&str[i]<='Z'))
            {
                large++;

            }
            if(str[i]=='_'||str[i-1]==')')
            {

                t++;

                if(t==1)
                temp=large;
                if(t>1)
                {
                    if(temp>=large)
                    {
                        temp=temp;

                    }
                    else
                    {
                        temp=large;
                    }
                }
              large=0;
            }

        }
        if(str[i]==')')
        {
            result=0;
        }
    }

    cout<<temp<<" "<<word<<endl;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int a[10000];
int  strr(string s)
{
    int cnt = 0;
    string r = "";
    s += "_";
    bool ok = 1;
    for(int i = 0; i < s.size(); i ++)
    {
        if(s[i] == '_' and r.size() != 0)
        {
                cnt ++;
                r = "";
        }
       else if(s[i] != '_')
        {
            r += s[i];
        }
    }
    return cnt;
}
int strr1(string s)
{
    int cnt = 0;
    string r = "";
    s += "_";
    for(int i = 0; i < s.size(); i ++)
    {
        if(s[i] =='_' and r.size() != 0)
        {
            cnt = max(cnt,(int)(r.size()));
            r = "";
        }
        else if(s[i] != '_')
        {
            r += s[i];
        }
    }
    return cnt;
}
main()
{
    int n ,ans = 0,id = 0;
    cin >> n;
    string s, w = "",ss = "";
    cin >> s;

    for(int i = 0; i < s.size(); i ++)
    {

        if(s[i] == '(' or s[i] == ')')
        {
            id = max(id,strr1(ss));
            ss = "";
            int k = i;
            for(int j = k + 1; ; j ++)
            {
                i ++;
                if(s[j] == ')' or s[j] == '(')
                {
                    ans += strr(w);
                    w = "";
                    break;
                }
                else
                {
                    w += s[j];
                }
            }
        }
        else
        {
            ss += s[i];
        }
    }
    cout << id << "  " << ans;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    vector <string> pw,w;
    int maxi=0;
    string k;
    transform(s.begin(), s.end(), s.begin(), ::tolower);
    int flag=0;
    int wcount=0;
    int prev=0;
    for(int i=1;i<n;i++)
    {
        if(s[i]=='_'&&flag==0)
        {
            maxi=max(i-prev-1,maxi);
            prev=i;
        }
        else if(s[i]=='(')
        {
            flag=1;
            prev=i;
        }
        else if(s[i]=='_'&&flag==1)
        {
            if(i-1-prev>=1)
            {
                wcount++;
            }
            prev=i;
        }
        else if(s[i]==')')
        {
            flag=0;
            if(i-1-prev>=1)
            {
                wcount++;
            }
            prev=i;
        }
        //cout<<maxi<<" "<<wcount<<" "<<prev<<" "<<i<<endl;
    }
    if(n-prev-1>=1)
    {
        maxi=max(maxi,n-prev-1);
    }
    cout<<maxi<<" "<<wcount;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    char str[n];
    cin>>str;
    int i=0;
    bool stop=false;
   int temp;
   int maxi=0;
   int counti=0;

   if(n==1)
   {
     if(str[i]!='_')
        maxi++;

   }

   else
    while(str[i]!='\0')
    {
        if(str[i-1]==')')
            stop=false;
        if(str[i-1]=='(')
            stop=true;

        if(!stop)
        {
            temp=0;
          while(str[i]!='_'&&str[i]!='('&&str[i]!='\0')
          {
              temp++;
              i++;
          }

          if(maxi<temp)
            maxi=temp;

        }

        if(stop)
        {
            int x=0;

        while(str[i]!='_'&&str[i]!=')')
        {
           x++;
           i++;

        }

        if(x!=0)
            counti++;
        }
        i++;
    }

    cout<<maxi<<" "<<counti;

}

#include <bits/stdc++.h>

using namespace std;

#define mt(a,x,b) memset(a,x,sizeof a)
#define mem(a) memset(a,0,sizeof a)
#define lp(i,n)  for(i=0;i<n;i++)
#define lpp(x,a,b) for(x=a;x<=b;x++)
#define pb push_back
#define prr pair<int,int>
#define imn INT_MAX
#define imx INT_MIN
#define sc scanf
#define pt(tc)  printf("Case %d: ",tc++)
#define ptt(tc) printf("Case %d:\n",tc++)
#define pf printf
#define op(n) cout<<n<<endl
#define eps 1.e-9
#define ff first
#define ss second
#define ll long long
#define wh(t)  while(t--)
#define pcse printf("Case %d: ",case++)
#define ug unsigned
#define fin  freopen("input.txt","r",stdin)
#define fout  freopen("output.txt","w",stdout)
#define  sc1(x)      scanf("%d",&x)
#define  sc2(x,y)    scanf("%d %d",&x,&y)
#define  sc3(x,y,z)  scanf("%d %d %d",&x,&y,&z)
#define  scl1(x)     scanf("%lld",&x)
#define  scl2(x,y)   scanf("%lld %lld",&x,&y)
#define  scl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define  scf1(x)     scanf("%lf",&x)
#define  scf2(x,y)   scanf("%lf %lf",&x,&y)
#define  pf1(x)      printf("%d\n",x)
#define srt(a) a.begin(),a.end()
#define  pfl1(x)     printf("%lld\n",x)
#define LB(a,x) (lower_bound(srt(a),x)-a.begin())
#define UB(a,x) (upper_bound(srt(a),x)-a.begin())

#define MX

ll mod = 1;

//int Set(int n,int pos)  { return n = n | 1<<pos;}
//bool check(int n,int pos) { return n & 1<<pos;}
//int Reset(int n, int pos) { return n=n & ~(1<<pos);}
//template<class T> inline T on(T n, T pos){return n | (1<<pos);}
//template <class T> inline T check(T n, T pos){return (bool)  n&(1<<pos);}
//template<class T> inline T gcd(T a, T b){if(b==0)return a ;else return gcd(b,a%b);}
//template <class T> inline T bigmod(T p,T e,T M){ll ret = 1;for(; e > 0; e >>= 1){if(e & 1) ret = (ret * p) % M;p = (p * p) % M;}return (T)ret;}
//template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}
//template<class T> inline T lcm(T a, T b) {return a*b/gcd(a,b);}
//template<class T> inline T diff(T x2,T x1, T y2 ,T y1  ){double x ,y; x=((x2-x1)*(x2-x1)); y = ((y2-y1)*(y2-y1));return sqrt(x+y);}
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};
//int dxh[]={2,1,-1,-2,-2,-1,1,2};int dyh[]={1,2,2,1,-1,-2,-2,-1};
//int toInt(string s){int sm;stringstream ss(s);ss>>sm;return sm;}
//int toLlint(string s){long long int sm;stringstream ss(s);ss>>sm;return sm;}
//string toStr(int number) {string Str; ostringstream convert; convert<< number;Str = convert.str();return Str; }
//template <class T> inline T bpow(T p,T e){ll ret = 1;for(; e > 0; e >>= 1){if(e & 1) ret = (ret * p);p = (p * p);}return (T)ret;}
int n;
string s;
int mx=imx;
int main()
{

    int i,j,t,tc=1,a,b;
    sc1(n);
    cin>>s;
    int l=s.length();
    int c=0;
    int cnt=0;
    for(i=0;i<l;)
    {
       if(s[i]=='(')
       {

           if(c!=0)
            mx=max(c,mx);
           for(j=i+1;j<l;j++)
           {
               if(s[j]==')')
                break;
           }
           i=j;
          //
          // cout<<i<<" "<<j<<endl;
       }
       else if(s[i]>='A'&&s[i]<='Z'||s[i]>='a'&&s[i]<='z')
       {
           c++;
           i++;
       }
       else
       {
           mx=max(c,mx);
           c=0;
           i++;
       }
    }
    if(c!=0)
        mx=max(mx,c);
         c=0;

       // op(cnt);
       cnt=0;
    for(i=0;i<l;)
    { // op(cnt);
       // op(i);
      // c=0;
        if(s[i]=='(')
        {   // c=0;
            for(j=i+1;j<l;j++)
            {  // c=0;
                if(s[j]==')')
                {
                    if(c>0)
                        cnt++;
                    break;
                }
                if(s[j]>='A'&&s[j]<='Z'||s[j]>='a'&&s[j]<='z')
                    {
                        c++;
                       //cout<<s[j]<<endl;
                    }//
                else if(s[j]!=')')
                { //  cout<<j<<" "<<s[j]<<endl;
                    if(c>0)
                        cnt++;
                    c=0;
                }
            }
            i=j;
        }
        else
            i++;

    }
  //op(cnt);

cout<<max(0,mx)<<" "<<cnt<<endl;

    return 0;
}

/*
 * shoflk kalba.cpp
 *
 *  Created on: Sep 17, 2016
 *      Author: A7mD Sa3iiD
 *		time: 11:15:28 PM
 */

#include <bits/stdc++.h>
#include<bitset>
using namespace std;
#define bye return 0
#define oo 0x3f3f3f3f
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define F  first
#define S  second
#define EPS 1e-9
#define khod push_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<int, int> mpii;
typedef map<ll, ll> mpll;
int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int dy[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
double PI = 3.1415926535897932384626433832795;
string vowel = "aeiouy";
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	/*#ifndef ONLINE_JUDGE
	 freopen("buy.in", "r", stdin);
	 freopen("output.txt", "w", stdout);
	 #endif*/
	int n ;
	string s ;
	cin>>n;
	cin.ignore();
	getline(cin,s);
	string tmp = s ;
	for(int i = 0; i < n ; i++){
		if(tmp[i]=='('){
			for(int j = i ; ;j++){
				if(tmp[j]==')'){tmp[j]='*';break;}
				tmp[j]='*';

			}
		}
	}
	int cnt = 0 , c = 0;
	for(int i = 0 ; i < n ; i++){
		if(s[i]=='('){
			for(int j = i+1 ; ; j++){
				if(s[j]!='_'&&s[j]!=')')c++;
				else {
					if(c)cnt++;
					c=0;

				}
				if(s[j]==')'){i=j+1;break;}
			}
		}
	}
	int mx = 0 ;
	c = 0 ;
	for(int i = 0 ; i < n ; i++){
		if(tmp[i]=='*'){
			c=0;
		}
		else {
			if(tmp[i]=='_'){
				mx=max(mx,c);
				c=0;
			}
			else c++;
		}
	}
	if(c)mx=max(mx,c);
	cout<<mx<<" "<<cnt;

	bye;
}

#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int main(){
	char s[555];
	int n;
	scanf("%d", &n);
	scanf("%s", s);
	int ans1=0, ans2=0;
	for(int i=0; i<n ;i++){
		if(s[i]=='('){
			while(s[i]!=')'){
				i++;
				bool ok=0;
				while(s[i]!='_'&&s[i]!=')'){
					ok=1;
					i++;
				}
				if(ok)
					ans2++;
			}
		}
		else if(s[i]=='_'||s[i]==')')
			continue;
		else{
			while(s[i]!='('&&s[i]!='_'&&i<n){
				int len=0;
				while(s[i]!='('&&s[i]!='_')
					len++,i++;
				ans1=max(ans1, len);
			}
			if(s[i]=='(')
				i--;
		}
	}
	cout<<ans1<<' '<<ans2<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define pb push_back

#define fr(i,a,b)   for(i=a;i<=b;i++)
#define frn(i,a,b)  for(i=a;i>=b;i--)
#define mem(arr,val)    memset(arr,val,sizeof(arr))
#define mp make_pair
#define pii pair<int,int>
#define F first
#define S second
#define sz(x) (int)(x).size()

int brack[300],i,j,word,mx=0,n,k,sz;
string s;

int main()
{
    //freopen("d://i.txt","r",stdin);
    //freopen("d://o.txt","w",stdout);
    cin>>n>>s;

    sz=sz(s);
    //cout<<sz<<endl;

    for(i=0; i<sz; i=j)
    {
        j=i;
        int cnt=1,con=0;

        if(s[i]=='(')
        {
            j=j+1;
            while(j<sz && s[j]!=')')
            {
                if(s[j]!='_')
                    con++;
                else
                {
                    if(con)
                        word++;

                    con=0;
                }

                j++,cnt++;
            }

            if(con)
                word++;

           // j++;
           // cnt++;

            brack[i]=cnt;
        }
        else
         {
             j++ ;
             continue;
         }
    }

    int con=0;

//fr(i,0,sz-1)
  //   cout<<i<<" "<<brack[i]<<endl;

    for(i=0; i<sz; i+=brack[i]+1)
    {
        //cout<<s[i]<<" ";
        if(s[i]=='(')
            continue;

        if(s[i]!='_')
            con++;
        else
        {
            mx=max(mx,con);
            con=0;
        }

    }

    mx=max(mx,con);

   cout<<mx<<" "<<word<<endl;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define in 0
#define out 1
/*bool isalpha(char a)
{
	 if((a>='A'&&a<='Z')||(a>='a'&&a<='z'))
	 return true;

	 return false;
}*/
int main()
{
	int n;
	cin>>n;
	string str;
	cin>>str;
	int i=0;
	int cwl=0,cnwp=0,max=0,mn=0;
	int flag=0;
	while(i<n)
	{
	    if(str[i]=='(')
		{while(1)
			{
			if(isalpha(str[i+1]))
			{
				flag=1;
			}
			else
			{
				if(str[i+1]==')')
			    {
				if(flag)
				{
				flag=0;
				++mn;
				}
				break;
			    }
			    else
			    {
			    if(flag)
				 {
				 flag=0;
				 ++mn;
				 }
				}
			 }
			 i++;
		    }
		    i++;
		}
	 else
	 {
	  if(isalpha(str[i]))
		{
			++i;
			cwl++;

		}
		else
		{
			++i;
			if(max<cwl)
			{
			max=cwl;

		    }
			cwl=0;
		}
	 }

	}

	cout<<max<<" "<<mn<<endl;
	return 0;
}

#include<iostream>
#include<vector>
#include<bits/stdc++.h>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<iomanip>
#define lli long long int
using namespace std;

int main(){
int n;
cin>>n;

string x;
cin>>x;
bool para = false;
int mx1 = 0;
int mx2 = 0;
int cnt = 0;
int cnt2 = 0;
for(int i=0; i<x.length(); i++){
    if(x[i] == '('){
        cnt = 0;
       para = true;
    }

    else if(x[i] == ')')
        {
        para = false;

        cnt2++;
        }

    if(para){
        if(x[i] == '_'){
           cnt2++;
        }

    }else{
        if(x[i] == '_'){
            mx1 = max(mx1,cnt);
            cnt = 0;
        }else
        cnt++;

    }
}
cout<<mx1<<' '<<cnt2<<endl;
}

#include <iostream>

using namespace std;
bool isalphabet ( char a ) {
    if ( a >= 65 && a <= 90 ) return true;
    if ( a >= 97 && a <= 122 ) return true;
    return false;
}
int main()
{
    int N;
    cin >> N;
    char str1[N];
    cin >> str1;
    int i = 0;
    int maxLenOutside = 0;
    int countWordInside = 0;
    int tempCount = 0;
    bool insideCheck = false;

    while( i < N ) {
        if ( str1[i] == '(' ) insideCheck = true;
        if ( str1[i] == ')' ) insideCheck = false;
        if ( str1[i] == '_' ) tempCount = 0;
        if ( isalphabet(str1[i]) ) {
            if ( !insideCheck ) {
                tempCount++;
            }
        }
        if ( i < N-1 ) {
            if ( !isalphabet(str1[i]) && isalphabet(str1[i+1]) ) { // word starting
                if ( insideCheck )
                    countWordInside++;
            }
        }
        if ( maxLenOutside < tempCount ) maxLenOutside = tempCount;
        i++;

    }
    cout << maxLenOutside << " " << countWordInside << endl;
   return 0;
}

#include <iostream>
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <numeric>
#include <vector>
#include <cmath>
#include <map>
#include <ctype.h>
#include <set>
#include <iterator>
using namespace std;

int main(){
   int n; cin >> n;
   string s; cin >> s;
   int x, y;

   int maxWord = INT_MIN;
   int count = 0;

   for(int x=0; x<n; x++){
    if(s[x] == '_'){
        maxWord = max(count, maxWord);
        count = 0;
    }else if(s[x] == ')' || s[x] == '('){
        count = 0;
        continue;
    }else{
        count++;
    }
   }
   x = maxWord;
   count = 0;
   maxWord = 0;
   bool bruh = false;
   int damn [10000];
   int index = 0;

   for(int x=0; x<n; x++){
        if(s[x] == '('){
            bruh = true;
        }else if(s[x] == ')'){
            bruh = false;
        }else if(bruh == false){
            if(s[x] == '_'){
                index++;
                damn[index] = s[x];
            }else{
                damn[index]+=s[x];
            }
        }
   }

   for(int x=0; x<index+1; x++){
        if(damn[x] != '_' && damn[x]!=' ' && damn[x] != 0){
            count++;
        }
   }

   cout << x<< " " << count <<  endl;

}

#include <iostream>
#include <stdlib.h>
#include <math.h>
#include<bits/stdc++.h>
#include <string>
#include <array>

using namespace std;
int binarySearch(array<int,2> ar[],int x,int s,int f){

    int k=(s+f)/2;
    if(f-s>1){
        if(ar[k][0]==x)
            return k;
        if(ar[k][0]<x)
            return binarySearch(ar,x,k,f);
        if(ar[k][0]>x)
            return binarySearch(ar,x,s,k);
    }
    if(x>=ar[f][0])
        return f;
    return s;

}

bool isPrime(int n){
    if(n==2)
        return true;
    for(int i=2;i<sqrt(n)+2;i++){
        if(n%i==0)
            return false;
    }
    return true;

}
int main()
{
    //string a="ajk_fjkls_kl(kj_l)jkl__";
    //cout<<a.substr(0,3);
    int n;
    string s;
    cin>>n>>s;
    s+='_';
    s.insert(0,"_");
    //cout<<s<<endl;
    n+=2;
    int inPar=0,outPar=0;
    for(int i=0;i<n;i++){
//cout<<"i: "<<i<<endl;
 //   cout<<outPar<<" "<<inPar<<endl;
        if(s[i]=='('){
            //inPar=true;
            for(int j=i+1;j<n;j++){
                if((s[j]=='_' || s[j]==')') && s[j-1]!='_' && s[j-1]!='(')
                    inPar++;
                if(s[j]==')'){
                    i=j;
                    break;
                }
            }
        }
        else {
            bool flag=false;
            int tool=0;
            if(s[i]!='_')
                tool++;
            for(int j=i+1;j<n;j++){
                if(s[j]!='_' && s[j]!='('){
                    tool++;
                    flag=true;
                }
                else if(s[j]=='_' &&flag){
                    i=j;
                    if(tool>outPar)
                        outPar=tool;
                    break;
                }
                else if(s[j]=='('){
                    if(tool>outPar)
                        outPar=tool;
                    i=j-1;
                    break;
                }
            }
        }

    }
//cout<<endl;
    cout<<outPar<<" "<<inPar;

    return 0;
}

#include <iostream>
#include <tuple>
#include <cctype>
using namespace std;

auto solution(const string& input) -> tuple<int, int> {
    int longest_word_outside = 0;

    int word_length = 0;
    int number_words = 0;

    bool inside = false;
    bool pre_is_alpha = false;
    for(auto s : input) {
        if (s == '(') {
            inside = true;
            if (word_length > longest_word_outside)
                longest_word_outside = word_length;
            word_length = 0;
            pre_is_alpha = false;
            continue;
        }
        if (s == ')') {
            inside = false;
            pre_is_alpha = false;
            continue;
        }
        if (!inside && s == '_') {
            if (word_length > longest_word_outside)
                longest_word_outside = word_length;
            word_length = 0;
            pre_is_alpha = false;
            continue;
        }
        if (!inside && isalpha(s)) {
            ++ word_length;
            continue;
        }
        if (inside) {
            if (s == '_') {
                pre_is_alpha = false;
                continue;
            } else if (isalpha(s) && !pre_is_alpha) {
                ++ number_words;
                continue;
            } else if (isalpha(s)) {
                pre_is_alpha = true;
                continue;
            }
        }
    }
    if (word_length > longest_word_outside)
        longest_word_outside = word_length;
    return {longest_word_outside, number_words};
}

int main(int argc, char* argv[]) {
    int length;
    cin >> length;
    string input;
    cin >> input;

    auto ret = solution(input);
    cout << std::get<0>(ret) << ' ' << std::get<1>(ret) << '\n';
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    char str[n];
    cin>>str;
    int i=0;
    bool stop=false;
   int temp;
   int maxi=0;
   int counti=0;
    while(str[i]!='\0')
    {
        if(str[i-1]==')')
            stop=false;
        if(str[i-1]=='(')
            stop=true;

        if(!stop)
        {
            temp=0;
          while(str[i]!='_'&&str[i]!='('&&str[i]!='\0')
          {
              temp++;
              i++;
          }

          if(maxi<temp)
            maxi=temp;

        }

        if(stop)
        {
            int x=0;

        while(str[i]!='_'&&str[i]!=')')
        {
           x++;
           i++;

        }

        if(x!=0)
            counti++;
        }
        i++;
    }

    cout<<maxi<<" "<<counti;

}

#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#define eps 1e-8
#define zero(x) (((x>0?(x):-(x))-eps)
#define mem(a,b) memset(a,b,sizeof(a))
#define memmax(a) memset(a,0x3f,sizeof(a))
#define pfn printf("\n")
#define ll __int64
#define mod 1000000007
#define sf(a) scanf("%d",&a)
#define sf64(a) scanf("%I64d",&a)
#define sf264(a,b) scanf("%I64d%I64d",&a,&b)
#define sf364(a,b,c) scanf("%I64d%I64d%I64d",&a,&b,&c)
#define sf2(a,b) scanf("%d%d",&a,&b)
#define sf3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define sf4(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d)
#define sff(a) scanf("%f",&a)
#define sfs(a) scanf("%s",a)
#define sfs2(a,b) scanf("%s%s",a,b)
#define sfs3(a,b,c) scanf("%s%s%s",a,b,c)
#define sfd(a) scanf("%lf",&a)
#define sfd2(a,b) scanf("%lf%lf",&a,&b)
#define sfd3(a,b,c) scanf("%lf%lf%lf",&a,&b,&c)
#define sfd4(a,b,c,d) scanf("%lf%lf%lf%lf",&a,&b,&c,&d)
#define sfc(a) scanf("%c",&a)
#define debug printf("***\n")
const double PI = acos(-1.0);
const double e = exp(1.0);
const int INF = 0x7fffffff;;
template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> inline T Min(T a, T b) { return a < b ? a : b; }
template<class T> inline T Max(T a, T b) { return a > b ? a : b; }
bool cmpbig(int a, int b){ return a>b; }
bool cmpsmall(int a, int b){ return a<b; }
using namespace std;
int main()
{
	int n;
	while(~sf(n))
	{
		char s[300];
		sfs(s);
		int flag1=0,flag2=0,pos=0,i,l=strlen(s);
		for(i=0;i<l;i++)
		{
			if(s[i]=='(')
			{
				for(i;i<l;i++)
					if(s[i]==')')
						break;
				continue;
			}
			if(s[i]==')')
				continue;
			if(s[i]=='_')
			{
				flag1=max(flag1,pos);
				pos=0;
				continue;
			}
			else
				pos++;
		}
		for(i=0;i<l;i++)
		{
			if(s[i]=='(')
			{
				for(i;i<l;i++)
				{
					if(s[i]==')')
					{
						if(s[i-1]!='_'&&s[i-1]!='(')
							flag2++;
						break;
					}
					if(s[i]=='_'&&s[i-1]!='('&&s[i-1]!='_')
						flag2++;
				}
			}
		}
		printf("%d %d\n",flag1,flag2);
	}
	return 0;
}

#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include <stdlib.h>
#include<iomanip>
#include<algorithm>
#include<assert.h>
#include<deque>
#include<set>
#include<map>
#include<fstream>
#include<istream>
#include<ostream>
using namespace std;

#define ll		long long
#define MP		make_pair
#define ull		unsigned long long
#define vint	vector<int>
#define vid		vector<double>
#define vll		vector<ll>
#define pb		push_back
#define PI      3.1415926536
#define all(v)  ((v).begin()),((v).end())
#define sz(v)   ( (int) (v.size()) )

void fast()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}

int main ()
{
	int pon=0,n,ws=0,ch1=0,ch2=0,mx=0;
	string s;
	cin>>n>>s;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='(')
		{
			pon=1;
			continue;
		}
		if(s[i]==')')
		{
			pon=0;
			continue;
		}
		if(pon)
		{
			if(s[i]=='_'&&ch1)
				ch1=0,ws++;
			else if(s[i]!='_')
			   ch1++;
		}
		else
		{
		  	if(ch1)
		      ch1=0,ws++;
			if(s[i]=='_')
				mx=max(mx,ch2),ch2=0;
			else
				ch2++;
		}
	}
	mx=max(mx,ch2),ch2=0;
	if(ch1)
		ws++;
	cout<<mx<<" "<<ws;
}

#include <bits/stdc++.h>
using namespace std;

int main()
{
ios::sync_with_stdio(false);
string s;
int n;
cin>>n;
cin>>s;
int nu=0,maxi=0,open=0,res=0,test=0;
for(int i=0;i<n;i++)
{
    if(s[i]=='(')
    {
       open++;
    }
    if(s[i]==')')
    {
       open=0;
    }
    if(open>0)
    {
        if(s[i]=='_')
            res+=2;
    }
    if(open==0)
    {
    if((s[i]=='_')&&(nu==0))
        nu++;
    else if((s[i]=='_')&&(nu>0))
        {
            nu=0;
            test=0;
        }
        if(nu>0)
        {
            test++;
            if(maxi<test)
                maxi=test;
        }

    }
}
cout<<maxi-1<<" "<<res;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int n;
int cnt, ma;
string s, buf;
map<string, int> w;
bool bracket;

int main() {
	cin >> n >> s; s += '_';
	for(int i = 0; i < n; i++) {
		if(s[i] == '(') {
			bracket = true; buf = "";
		} else if(s[i] == ')') {
			bracket = false;
			if(buf.size()) cnt++;
			buf = "";
		} else if(s[i] == '_' && bracket) {
			if(buf.size()) cnt++;
			buf = "";
		} else if(s[i] == '_' && ! bracket) {
			ma = max((int) buf.size(), ma);
			buf = "";
		} else {
			buf += s[i];
		}
	}
	cout << ma << " " << cnt;
}

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <fstream>
using namespace std;
int main()
{
    int n;
    string s;
    int count = 0, max = 0;
    cin >> n >> s;
    vector<int> posPar;
    vector<int> posDash1;
    vector<int> posDash2;
    for(int i = 0; i < s.size(); i++)
        if(s[i] == '(' || s[i] == ')')
            posPar.push_back(i);
    string sPar = "";
    string newS = "";
    if(posPar.size() == 0)
    {
        newS = s;
    }
    else
    {
        for(int i = 0; i < posPar.size() - 1; i += 2)
        {
            sPar += s.substr(posPar[i], posPar[i + 1] - posPar[i] + 1);
        }
        newS += s.substr(0, posPar[0] + 1);
        for(int i = 1; i < posPar.size() - 1; i += 2)
        {
            newS += s.substr(posPar[i], posPar[i + 1] - posPar[i] + 1);
        }
        int lastPos = posPar[posPar.size() - 1];
        newS += s.substr(lastPos, s.size() - lastPos);
        for(int i = 0; i < sPar.size(); i++)
            if(sPar[i] == '_' || sPar[i] == '(' || sPar[i] == ')')
                posDash2.push_back(i);
        for(int i = 0; i < posDash2.size() - 1; i++)
            if(posDash2[i + 1] - posDash2[i] > 1)
                count++;
    }
    posDash1.push_back(0);
    for(int i = 0; i < newS.size(); i++)
        if(newS[i] == '_' || newS[i] == '(' || newS[i] == ')')
            posDash1.push_back(i);
    posDash1.push_back(newS.size());
    for(int i = 0; i < posDash1.size() - 1; i++)
        if(max < posDash1[i + 1] - posDash1[i])
            max = posDash1[i + 1] - posDash1[i] - 1;
    cout << max << " " << count;
}

#include <bits/stdc++.h>

using namespace std;

int n, cnt, ans, ans2;
string txt;

int jump(int x) {
	for(int i = x + 1; i < n; i++)
		if(txt[i] == ')')
			return i;
}

void cal_ans() {
	ans = max(cnt, ans), cnt = 0;
}

void cal_ans2(int x) {
	bool flag = 0;
	int r = jump(x - 1);
	for(int i = x; i < r; i++) {
		if(txt[i] != '_')
			flag = 1;
		else
			ans2 += ((flag) ? 1 : 0), flag = 0;
	}
	if(flag)
		ans2++;
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> txt;
	int i = 0;
	while(i < n) {
		if(txt[i] == '(') {
			cal_ans(), i = jump(i) + 1;
			continue;
		}
		if(txt[i] != '(' && txt[i] != '_')
		 	cnt++;
		if(txt[i] == '_')
			cal_ans();
		i++;
	}
	i = 0;
	while(i < n) {
		if(txt[i] == '(')
			cal_ans2(i + 1), i = jump(i) + 1;
		else
			i++;
	}
	return cout << ans << " " << ans2 << endl, 0;
}

#include <iostream>
#include <sstream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <utility>

//#include "segment_tree.h"
//#include "fenwick_tree.h"
//#include "union_find.h"
//#include "geometry.h"
using namespace std;

#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define DOW(i,a,b) for(int i = (a); i >= (b); i--)
#define REP(i,a) for(int i=0,_a=(a); i<_a; ++i)
#define FORI(it, x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define RESET(c,val) memset(c,val,sizeof(c))

#define ALL(x) x.begin(), x.end()
#define UNIQUE(c) (c).resize(unique(ALL(c)) - (c).begin())

#define sz(a) int(a.size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second

// bitmask
#define isOn(S, j) (S & (1 << j))
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define lowBit(S) (S & (-S))
#define setAll(S, n) (S = (1 << n) - 1)

// other manipulation
#define modulo(S, N) ((S) & (N - 1)) // return S % N, where N = 2^k
#define isPowerOfTwo(S) (!(S & (S - 1))
#define nearestPowerOfTwo(S) ((int)pow(2.0, (int)((log((double)S) / log(2.0)) + 0.5)))
#define turnOffLastBit(S) ((S) & (S-1))
#define turnOnLastZero(S) ((S) | (S+1))
#define turnOffLastConsecutiveBits(S) ((S) & (S + 1))
#define turnOnLastConsecutiveZeroes(S) ((S) & (S - 1))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

/*---------------------------*/

using namespace std;

int main()
{
	string S;
	cin >> S;
    cin >> S;
	int countIn= 0, countLong= 0, countParen= 0, longMax= 0;
	for(int i= 0; i < S.size(); i++)
	{
		switch (S[i])
		{
			case '(':
				if( countLong && !countParen && countLong > longMax ) longMax= countLong;
                countLong= 0;
				countParen++;
				break;
			case ')':
				countParen--;
				if( countLong )
                {
                    countIn++;
                    countLong= 0;
                }
				break;
			default:
				if( S[i] >= 'a' && S[i] <= 'z' || S[i] >= 'A' && S[i] <= 'Z' )
                    countLong++;
                else
                {
                    if( countParen && countLong )
                        countIn++;
                    else
                        if( countLong > longMax ) longMax= countLong;
                    countLong= 0;
                }
		}
	}
	cout << longMax << " " << countIn ;
}

#include<iostream>
#include<string>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<map>
using namespace std;
ofstream fo("test.out");
ifstream fi("test.inp");
int  n, m, k, dem, maxx, rs, sum;
int resources;
//long long a[100005], rs;
//map<string,int>rs;
#define N 100005
string s;
int main()
{
	cin >> n;
	cin >> s;
	int outside=0, inside=0;
	char t;
	for (int i = 0; i < n;)
	{
		t = s[i];
		if (s[i] == '(')
		{
			while (s[i] != ')')
			{
				dem = 0;
				i++;
				t = s[i];
				while (s[i] != '_'&&s[i] != ')'&&s[i]!='(')
				{
					i++;
					dem = 1;
					t = s[i];
				}
				if (dem == 1) inside++;
			}
		}
		int temp = 0;
		if (i == n-1) break;
		while (s[i] != '_'&&s[i] != '(')
		{
			i++;
			dem = 1;
			temp++;
			t = s[i];
		}
		if (dem == 1) outside = max(outside, temp);
		if (s[i] == '_') i++;
	}
	cout << outside << " " << inside;
}

#include <iostream>
#include <cstring>

using namespace std;

//length of largest word outside parenthesis
//number of words inside parenthesis
//37
//_Hello_Vasya(and_Petya)__bye_(and_OK)
//37
//_a_(_b___c)__de_f(g_)__h__i(j_k_l)m__

int main()
{
    int n, largestwordindex, counter1=0, longest=0, wordcount=0, paren;
    cin>>n;
    char c[n];
    cin>>c;
    bool inside=false, word=false;
    for (int i=0; i<strlen(c); i++) {
        if (c[i]=='(') {
                inside=true;
                continue;
            }
        if (c[i]==')') {
                inside=false;
                word=false;
                continue;
        }
        if (inside==false) {
            if (c[i]!='_') {
                counter1++;
            }
            if (c[i]=='_') {
                    if (longest<counter1) {
                longest=counter1;
                    }
                counter1=0;
                continue;
            }
        }
        if (inside==true) {
                if (c[i]!='_' && word==false) {
                    word=true;
                    wordcount++;
                    cout<<c[i]<<endl;
                    continue;
                }
                if (c[i]=='_' && word==true) {
                    word=false;
                    continue;
                }
        }
    }
    cout<<longest<<" "<<wordcount<<endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
    //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0);

    int n;
    cin >> n;
    int ans = 0, mx = 0, fl = 0, word = 0;
    for (int i = 0; i < n; i++) {
        char c;
        cin >> c;
        if (c == '(') {
            fl = true;
            word = 0;
        }
        if (c == ')') {
            fl = false;
            if (word) ans++;
            word = 0;
        }
        if (c == '_') {
            if (fl && word) ans++;
            word = 0;
        }
        if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
            word++;
        }
        mx = max(mx, word);
    }

    cout << mx << " " << ans << endl;

    return 0;
}

#include <stdio.h>
#include <ctype.h>

int max(int a[], int len)
{
 int i, m = a[0];
 for(i = 0; i <= len; i++)
  if(m < a[i])
   m = a[i];
 return m;
}

int main()
{
 int len, i, brackets = 0, words = 0;
 scanf("%d", &len);
 char str[len + 1];
 int length[len + 1];
 for(i = 0; i <= len; i++)
  length[i] = 0;
  int j = 0;
  scanf(" ");
 gets(str);
 for(i = 0; i < len; i++)
 {
  if(str[i] == '(')
   brackets = 1;
  else if(str[i] == ')')
   brackets = 0;
  else if(isalpha(str[i]))
  {
   if(!brackets)
   {
    length[j]++;
   }
   else
    continue;
  }
  else if(str[i] == '_')
  {
   if(!brackets)
    j++;
   else
   {
    if(isalpha(str[i + 1]))
     words++;
   }
  }
 }
 printf("%d %d\n", max(length, len), words);
}

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

bool b1, bw2;
vector <pair <int, int> > v;

int main() {
	int n;
	char s[260];
	scanf("%d%s", &n, &s);
	int mxword = 0, c = 0, h = 0;
	for (int i = 0; i < n; i++)
	{
		if (((s[i] >= 65 and s[i] <= 90) or (s[i] >= 97 and s[i] <= 122)) and !b1)
			c++;
		else if (s[i] == '(')
		{
			b1 = 1;
			v.push_back(make_pair(i, -1));
		}
		else if (s[i] == ')')
		{
			b1 = 0;
			v[v.size() - 1].second = i;
		}
		else if (s[i] == '_')
		{
			if (c > mxword)
				mxword = c;
			c = 0;
		}

	}
	for (int i = 0; i < v.size(); i++)
	{
		v[i].first++;
		while (s[v[i].first] == '_')
			v[i].first++;
		for (int j = v[i].first; j < v[i].second; j++)
		{
			if (s[j] == ')')
				break;
			while (s[j] == '_')
			{
				j++;
				bw2 = 1;
			}
			if (bw2 == 1)
				h++;
			if (s[j] != '_')
				bw2 = 0;
		}
		if (s[v[i].second - 1] != '_' && s[v[i].second] != ')' && s[v[i].second] != '(')
			h++;
	}
	printf("%d %d\n", mxword, h);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll a;
    cin>>a;
    getchar();
    char str[10000];
    gets(str);
    string str1[10000];
    string str2[10000];
    int x=0;
    int y=0;
    int c=0;
    int ans=0;
    for(int i=0; i<a; i++)
    {
        if(str[i]!='_' && str[i]!='(')
            c++;
        else if(str[i]=='_')
        {
            ans=max(ans,c);
            c=0;
        }
        else if(str[i]=='(')
        {
             ans=max(ans,c);
            c=0;
            while(str[i]!=')')
            {
                if(str[i]!='_')
                    str2[y]+=str[i];
                else if(str[i]=='_' && str[i-1]!='_' && str[i-1]!='(' ) y++;
                if(str[i]!='_' && str[i+1]==')') y++;
                i++;
            }
        }
    }
     ans=max(ans,c);
    cout<<ans<<" "<<y;
}

#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define fi first
#define se second
#define rep(i,f,n) for(int i=f;i<n;i++)
#define mset(b,f) memset(b,f,sizeof(b))
//#define sort(a) sort(a,a+n)
typedef long long ll;
typedef unsigned long long ull;
//int dx[]={1,0,1},dy[]={0,1,1},a,b;
//char s[5][5];
//multiset <pair<int,string > > s;
string s,d;
int main()
{ /*#ifdef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif*/
  int t; cin>>t;
  cin>>s;
  bool f=0;
  ll maxx=-9999999999999,k=0,w=0;
  int sl=s.length();
  rep(i,0,sl)
  { if(s[i]=='(')
    { i++;
      while(1)
      {
        if(s[i]!='('&&s[i]!='_')
         if(s[i+1]==')'||s[i+1]=='_') k++;

        i++;
        if(s[i]==')') break;
      }
    }
    else if(s[i]!='_')
    {
      while(1)
      { if(s[i]=='_'||s[i]=='('){ maxx=max(maxx,w); w=0;  break; }
        if(s[i]!='_'&&s[i]!='(') w++;
        //else
        i++;

      }
      i--;
    }
  }
  if(maxx<0) cout<<0<<" ";
  else cout<<maxx<<" ";
  cout<<k;
  return 0;
}

#include <iomanip>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>

using namespace std;
const long long M=1e9 +7;

int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	int max=0, ans=0, x=0;
	for(int i=0; i<s.size(); i++){
		if(s[i]=='('){
			if(x>max)max=x;
			x=0;
			i++;
			while(s[i]!=')'){
				if(s[i]!='_' && (s[i+1]=='_' || s[i+1]==')'))ans++;
				i++;
			}
			i++;
		}
		if(i>=n)break;
		if(s[i]=='_'){
			if(x>max)max=x;
			x=0;
		}else x++;
	}
	if(x>max)max=x;
	cout<<max<<" "<<ans;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

#define pb push_back
#define mp make_pair

using namespace std;

int main()
{
 ios_base::sync_with_stdio(false);
    int n;
    string a;
    cin >> n;
    cin >>a;
    int lest= 0, cnt = 0, tmp = 0;

    for( int i = 0; i < a.size(); i++ )
    {
        if( a[i] == '(' )
        {
         /*   if( a[i+1] == ')' )
            {
                cnt++;
                continue;
            }*/
            lest = max( lest, tmp );
            tmp =0;
           // cout << "tare     dd" << i<<  endl;
            while( a[i] != ')' && i< a.size() )
            {
                i++;
                if( a[i] == '_' )
                {
                    i++;
                 //   cout << "tare  " << endl;
                }
                    else
                {

                    while( (a[i] !=  '_' && a[i] != ')') && i < a.size()   )
                    {
                        i++;
                        cnt ++;
                     //   cout  << i << " prevara moj brate " << endl;
                    }
                }
            }
        }

      else  if( (a[i] >= 65 && a[i] <=90) || ( a[i] >= 97 && a[i] <= 122 )   ) tmp++;
        else
        {
            lest = max( lest, tmp );
          //  cout << lest << "stak sad pcko " << endl;
            tmp = 0;
        }
    }

    cout << lest << " " << cnt << endl;

return 0;
}

/**

M. Tahmid Hossain Olee.
What the hack !!!

*/
//C headers
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <ctype.h>
#include <assert.h>
#include <time.h>
//cpp headers
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <deque>
#include <list>
//#include <bits/stdc++.h>
//#include <bitset>
using namespace std;
//typedefs
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
//some constants
const double PI = 2.0 * acos(0.0);
//always useful
#define csprnt printf("Case %d: ", cas++);
#define gcd(a,b) __gcd(a,b)
#define clr(a) memset(a, 0, sizeof(a))
#define mem(a,b) memset(a, b, sizeof(a))
#define REP(i, a, n) for(int i = a; i < n; ++i)
#define RREP(i, a, n) for(int i = a; i > n; --i)
#define REPE(i, a, n) for(int i = a; i <= n; ++i)
#define RREPE(i, a, n) for(int i = a; i >= n; --i)
#define popc(i) (__builtin_popcount(i))
//useful with graphs
#define fr first
#define sc second
#define pb push_back
#define pp pop_back
#define mp make_pair
#define IT iterator
#define all(v) v.begin(), v.end()
#define ssort(v) stable_sort(v.begin(), v.end())
#define LB(v, x) lower_bound(v.begin(), v.end(), x)
#define UB(v, x) upper_bound(v.begin(), v.end(), x)
#define loop(i, x) for(__typeof((x).begin()) i=(x.begin()); i!=(x).end(); ++i)
#define rloop(i, x) for(__typeof((x).rbegin()) i=(x.rbegin()); i!=(x).rend(); ++i)
#define sz(a) (int)a.size()
#define sf scanf
#define pf printf
#define NL pf("\n")
#define sf1(a) scanf("%d",&a)
#define sf2(a,b) scanf("%d %d",&a,&b)
#define sf3(a,b,c) scanf("%d %d %d", &a,&b, &c)
/*--------------------------------------------------------------------------------------------------*/
#define MOD 1000000007
#define oo (1<<30)
//ll extGcd(ll a, ll b, ll& x, ll& y){if (b == 0){x = 1;y = 0;return a;}else{int g = extGcd(b, a % b, y, x);y -= a / b * x;return g;}}
//ll modInv(ll a, ll m){ll x, y; extGcd(a, m, x, y); x %= m; while (x < 0){x += m;} return x;}
//ll bigmod(ll a,ll b,ll m){if(b == 0) return 1%m;ll x = bigmod(a,b/2,m);x = (x * x) % m;if(b % 2 == 1) x = (x * a) % m;return x;}
//ll BigMod(ll B,ll P,ll M){ ll R=1%M; while(P>0) {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} return R;} /// (B^P)%M

//template <class T> inline T gcd(T a, T b){if(b == 0) return a;return gcd(b,a%b);}
//template <class T> inline T lcm(T a, T b){return (a/gcd(a,b)) * b;}

//int x[] = {0,0,-1,1};//4-way
//int y[] = {1,-1,0,0};//4-way
//ll x[] = {-1,-1,-1,0,0,1,1,1};//8-way
//ll y[] = {-1,0,1,-1,1,-1,0,1};//8-way
#define VAL(x) #x << " = " << (x) << "   "
#define SQR(a) ((a) * (a))
#define FOREACH(i, x) for(__typeof((x).begin()) i = (x).begin(); i != (x).end(); i ++)
template<class T1> void deb(T1 e)
{
    cout << e << endl;
}
template<class T1, class T2> void deb(T1 e1, T2 e2)
{
    cout << e1 << " " << e2 << endl;
}
template<class T1, class T2, class T3> void deb(T1 e1, T2 e2, T3 e3)
{
    cout << e1 << " " << e2 << " " << e3 << endl;
}
template<class T1, class T2, class T3, class T4> void deb(T1 e1, T2 e2, T3 e3, T4 e4)
{
    cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template<class T1, class T2, class T3, class T4, class T5> void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5)
{
    cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template<class T1, class T2, class T3, class T4, class T5, class T6> void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6)
{
    cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6 << endl;
}
template<typename T> inline T sqr(T n)
{
    return n * n;
}
inline double hypot(double x, double y)
{
    return sqrt(sqr(x) + sqr(y));
}
template<typename T> inline T pmod(T n, T m)
{
    return ((n % m) + m) % m;
}
template<typename T> T power(T n, int p)
{
    return (p == 0) ? (T)(1) : (sqr(power(n, p >> 1)) * ((p & 1) * (n - 1) + 1));
}
template<typename T> T bigmod(T n, int p, T m)
{
    return (p == 0) ? (T)(1) : ((sqr(bigmod(n, p >> 1, m)) % m) * ((p & 1) * (n - 1) % m + 1)) % m;
}
//inline long FastMax(long x, long y) { return (((y-x)>>(32-1))&(x^y))^y; }
//inline long FastMin(long x, long y) { return (((y-x)>>(32-1))&(x^y))^x; }
//inline long FastMin(long x, long y) { return (((y-x)>>(32-1))&(x^y))^x; }

//#include<conio.h>
//#define wait getch()
#define lson node*2,beg,mid
#define rson node*2+1,mid+1,end
/****************************** code start's from here ************************************************* */

int main()
{
    char a;
    string s;
    int len;
    cin>>len;
    cin>>s;

    string tmp = s;
    string b="";
    int mx = 0;
    int now;
    for(int i = 0; i<sz(tmp); i++)
    {
        now = 0;
        int j = i;
        if(tmp[j]=='(')
        {
            b.pb('_');
            while(tmp[j]!=')') j++;
            i = j;
        }
        if(i<sz(tmp) && tmp[i]==')')
        {
            continue;
        }
        if(i<sz(tmp)) b.pb(tmp[i]);
    }
    //deb(b);
    tmp = b;
    for(int i = 0; i<sz(tmp); i++)
    {
        now = 0;
        int j = i;
        if(i>0 && (tmp[i-1]=='_' || tmp[i-1]=='(') &&isalpha(tmp[i]))
        {
            while(j<sz(tmp) && isalpha(tmp[j]))
            {
                j++;
                now++;
            }
            //  deb(j,tmp[j]);
            if(j<sz(tmp) && (tmp[j]=='_' || tmp[j]=='('))
                mx = max(mx,now);
            i = j ;
        }
    }
    //deb(mx);

    tmp = s;
    b = "";
    for(int i = 0; i<sz(tmp); i++)
    {
        now = 0;
        int j = i;
        if(tmp[j]=='(')
        {
            while(tmp[j]!=')')
            {
                b.pb(tmp[j]);
                j++;
            }
            b.pb(tmp[j]);

            i = j;
        }
    }
    //deb(b);

    int words = 0;

    tmp = b;
    for(int i = 0; i<sz(tmp); i++)
    {
        now = 0;
        int j = i;
        if(i<sz(tmp) && i>0 && (tmp[i-1]=='_' || tmp[i-1]=='(') &&isalpha(tmp[i]))
        {
            // string aa = "";
            words++;
            while(isalpha(tmp[j]))
            {
                // aa+=tmp[j];
                j++;
                now++;
            }
            // deb(aa);

            i = j;
        }
    }
    deb(mx,words);
    return 0;
}
/**

olee
_olee()olee_
_olee()(___olee_)
_olee()(___olee_)oleeoooo()
_olee()(___olee_)oleeoooo()a_
*/

#include<cstdio>
#include<cmath>
#include<stdlib.h>
#include<map>
#include<set>
#include<time.h>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;

int main()
{

	string s;
	int n;

	cin >> n >> s;
	int cur = 0;//2->3
	int max =0;

	int par = 0;//()
	int wordsCount = 0;

	for(int i = 0; i< n; i++){
		if (s[i] == '_'){
			if(par == 0){//outside
				if(cur > max)
					max = cur;
			}
			else if (cur >0){//inside
				wordsCount++;
			}
			cur = 0;
		}

		else{
			if(s[i] == '(' || s[i] ==  ')' ){
				if(par == 0){//outside
					if(cur > max){
						max = cur;
					}
				}
				else{
					if (cur >0){//inside
						wordsCount++;
					}
				}
				par = 1-par;
				cur = 0;
			}
			else {
				cur++;
			}

		}
	}
	cout << max <<"  "<< wordsCount;
}

#include <iostream>
#include <math.h>
#include <string>
#include <cstdio>
using namespace std;

int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int n;cin>>n;
string s1,s;int max=1;int num=0;int j=1;
cin>>s;
int open=0;
for(int i=0;i<n-1;i++)
{
	if(s.at(i)=='(') open++;if(s.at(i)==')') if(open) open--;
	if(open)
		{
			int k=(int)(s.at(i));int l=(int)(s.at(i+1));
			if((k!=40 && k!=41 && k!=95) && (l==40||l==41||l==95)) num++;
		}
	else
	{
		int k=(int)(s.at(i));int l=(int)(s.at(i+1));
			if((k!=40 && k!=41 && k!=95) && (l==40||l==41||l==95)) {if(j>max) max=j;j=1;}
			else if(k!=40 && k!=41 && k!=95) j++;
			if(j!=1 && i==n-2) if(j>max) max=j;

	}
}
cout<<max<<" "<<num<<endl;

return 0;
}

#include<bits/stdc++.h>
#include<unordered_map>
#include<sstream>
#include <map>
#include<functional>
#include<stack>
#include<list>
#include<iomanip>
using namespace std;
#define ll long long
#define MAX 100000+5
#define MOD 1000000007
#define INF 1000000000
#define edge pair<ll,ll>
#define sz size()
//int dx[] = { 1, 0, -1, 0, 1, -1, -1, 1 };
//int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };
int main()
{

	int n;
	cin >> n;
	string s;
	cin >> s;
	int mx = 0, total = 0;
	int cnt = 0;
	for (int i = 0; i < n; i++){
		if (s[i] == '_'){
			if (cnt)mx = max(mx, cnt);
			cnt = 0;
		}
		else if (s[i] == '(') {

			if (cnt)mx = max(mx, cnt);
			int j;
			cnt = 0;
			for (j = i + 1; j < n; j++){
				if (s[j] == ')'){
					if (cnt)total++;
					break;

				}
				else if (s[j] == '_'){
					if (cnt)total++;
					cnt = 0;
				}
				else {
					cnt++;
				}
			}
			i = j - 1;
			cnt = 0;
			continue;
		}
		else cnt++;
	}
	cout << mx << " " << total;
	//system ("pause");
	//return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr first
#define sec second
int main()
{
int x,c=0,k=0,g=0,g1=0,b1=0,bb1=0;
cin>>x;
int h[x],h1=0;
memset(h,0,sizeof h);
string a[x];
char b[x],bb[x];
char t;
bool ok=false;
for (int i=0;i<x;i++)
{
cin>>t;

   if (t=='(')
        g1=1;

if (g1)
   {
       b[b1]=t;
       b1++;
   }
if (!g1)
{
    bb[bb1]=t;
    bb1++;
}
if (t==')')
{

    g1=0;
}
}
for (int i=0;i<bb1;i++)
{
    if (isupper(bb[i]))
        bb[i]=tolower(bb[i]);
    if (bb[i]>='a'&&bb[i]<='z')
        h[h1]++;
    else
        h1++;
}
cout<<*max_element(h,h+h1)<<" ";
for (int i=1;i<b1;i++)
{
if (isupper(b[i]))
    b[i]=tolower(b[i]);
if (b[i]>='a'&&b[i]<='z'&&b[i-1]=='_'||b[i]>='a'&&b[i]<='z'&&b[i-1]=='(')
            c++;
}
cout<<c;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

long long a, b, c, ans, res;
string s;
vector < char > v, vv;
vector < ll > vvv;
bool is(char c)
{
	if('a' <= c && c <= 'z' || 'A' <= c && c <= 'Z')
	return true;
	else
	return false;
}
int main()
{
	ll q;
	cin >> a;
	cin >> s;
	q = 0;
	for(ll i = 0; i < s.size(); i++)
	{
		if(s[i] == '(')
		{
			q = 1;
		}
		if(s[i] == ')')
		{
			q = 0;
		}
		if(q == 1)
		{
			v.push_back(s[i]);
		}
		if(q == 0)
		{
			vv.push_back(s[i]);
		}
	}
	for(ll i = 0; i < v.size(); i++)
	{
		if(is(v[i]) && !is(v[i + 1]))
		{
			ans++;
		}

	}
	for(ll i = 0; i < vv.size(); i++)
	{
		if('a' <= vv[i] && vv[i] <= 'z' || 'A' <= vv[i] && vv[i] <= 'Z')
		{
			res++;
		}
		else
		{
			vvv.push_back(res);
			res = 0;
		}
	}
	cout << *max_element(vvv.begin(), vvv.end()) << " " << ans;
		//cout << ans;
}

/*

   When I wrote this, Heaven and I knew what it meant; now, Heaven only knows.
 ***                   ***                 ***

   problem id :
   judge      :
   @uthor     : []\/[]?

 */

//C headers
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <ctype.h>
#include <assert.h>
#include <time.h>
//cpp headers
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <deque>
#include <list>
//#include <bits/stdc++.h>
//#include <bitset>
using namespace std;
//typedefs
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
//some constants
const double PI = 2.0 * acos (0.0);
const double E = exp (1);
//always useful
#define csprnt printf("Case %d: ", cas++);
#define gcd(a,b) __gcd(a,b)
#define clr(a) memset(a, 0, sizeof(a))
#define mem(a,b) memset(a, b, sizeof(a))
#define REP(i, a, n) for(int i = a; i < n; ++i)
#define RREP(i, a, n) for(int i = a; i > n; --i)
#define REPE(i, a, n) for(int i = a; i <= n; ++i)
#define RREPE(i, a, n) for(int i = a; i >= n; --i)
#define popc(i) (__builtin_popcount(i))
//useful with graphs
#define fr first
#define sc second
#define pb push_back
#define pp pop_back
#define mp make_pair
#define IT iterator
#define all(v) v.begin(), v.end()
#define ssort(v) stable_sort(v.begin(), v.end())
#define LB(v, x) lower_bound(v.begin(), v.end(), x)
#define UB(v, x) upper_bound(v.begin(), v.end(), x)
#define loop(i, x) for(__typeof((x).begin()) i=(x.begin()); i!=(x).end(); ++i)
#define rloop(i, x) for(__typeof((x).rbegin()) i=(x.rbegin()); i!=(x).rend(); ++i)
#define sz(a) (int)a.size()
#define sf scanf
#define pf printf
#define NL pf("\n")
#define sfs(a) scanf("%s",a)
#define sf1(a) scanf("%d",&a)
#define sf2(a,b) scanf("%d %d",&a,&b)
#define sf3(a,b,c) scanf("%d %d %d", &a,&b, &c)
/*--------------------------------------------------------------------------------------------------*/
#define MOD 1000000007
#define M 100100
#define oo (1<<30)
//ll extGcd(ll a, ll b, ll& x, ll& y){if (b == 0){x = 1;y = 0;return a;}else{int g = extGcd(b, a % b, y, x);y -= a / b * x;return g;}}
//ll modInv(ll a, ll m){ll x, y; extGcd(a, m, x, y); x %= m; while (x < 0){x += m;} return x;}
//ll bigmod(ll a,ll b,ll m){if(b == 0) return 1%m;ll x = bigmod(a,b/2,m);x = (x * x) % m;if(b % 2 == 1) x = (x * a) % m;return x;}
//ll BigMod(ll B,ll P,ll M){ ll R=1%M; while(P>0) {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} ret urn R;} /// (B^P)%M
//ll nCr(int n, int r) {if (r > n / 2) r = n - r; long long ret = 1; for (int i = 1; i <= r; i++) {ret *= n - r + i; ret /= i;} return ret;}
//template <class T> inline T gcd(T a, T b){if(b == 0) return a;return gcd(b,a%b);}
//template <class T> inline T lcm(T a, T b){return (a/gcd(a,b)) * b;}

//int x[] = {0,0,-1,1};//4-way
//int y[] = {1,-1,0,0};//4-way
//ll x[] = {-1,-1,-1,0,0,1,1,1};//8-way
//ll y[] = {-1,0,1,-1,1,-1,0,1};//8-way
#define VAL(x) # x << " = " << (x) << "   "
#define SQR(a) ((a) * (a))
#define FOREACH(i, x) for(__typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
template<class T1> void deb (T1 e)
{
        cout << "-->" << e << endl;
}
template<class T1, class T2> void deb (T1 e1, T2 e2)
{
        cout << "-->" << e1 << " " << e2 << endl;
}
template<class T1, class T2, class T3> void deb (T1 e1, T2 e2, T3 e3)
{
        cout << "-->" << e1 << " " << e2 << " " << e3 << endl;
}
template<class T1, class T2, class T3, class T4> void deb (T1 e1, T2 e2, T3 e3, T4 e4)
{
        cout << "-->" << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template<class T1, class T2, class T3, class T4, class T5> void deb (T1 e1, T2 e2, T3 e3, T4 e4, T5 e5)
{
        cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template<class T1, class T2, class T3, class T4, class T5, class T6> void deb (T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6)
{
        cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6 << endl;
}
template<typename T> inline T sqr (T n)
{
        return n * n;
}
inline double hypot (double x, double y)
{
        return sqrt (sqr (x) + sqr (y) );
}
template<typename T> inline T pmod (T n, T m)
{
        return ( (n % m) + m) % m;
}
template<typename T> T power (T n, int p)
{
        return (p == 0) ? (T) (1) : (sqr (power (n, p >> 1) ) * ( (p & 1) * (n - 1) + 1) );
}
template<typename T> T bigmod (T n, int p, T m)
{
        return (p == 0) ? (T) (1) : ( (sqr (bigmod (n, p >> 1, m) ) % m) * ( (p & 1) * (n - 1) % m + 1) ) % m;
}
//inline long FastMax(long x, long y) { return (((y-x)>>(32-1))&(x^y))^y; }
//inline long FastMin(long x, long y) { return (((y-x)>>(32-1))&(x^y))^x; }
//inline long FastMin(long x, long y) { return (((y-x)>>(32-1))&(x^y))^x; }

//#include<conio.h>
//#define wait getchar()

char str[400];

int parenthesis(int ind)
{
        int p=0;
        for(int i=ind; i>=0; i--)
        {
                if(str[i]=='('|| str[i]==')') p++;
        }
        return p;
}

int main()
{
        //freopen("inp.txt","r",stdin);
        //freopen("out.txt","w",stdout);
        int n,p=0,u=0,w=0,mx=0,pm=0,um=0;
        sf1(n);
        sfs(str);
        for(int i=0; i<n; i++)
        {
                if(str[i]>='a' || str[i]<='z' && str[i]>='A' && str[i]<='Z') w++;
                else
                {
                        if(parenthesis(i)%2==1)
                        {
                                if(w) pm++;
                        }
                        else um=max(um,w);
                        w=0;
                }
        }
        pf("%d %d\n",um,pm);
        return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
  int n ;
  cin >> n ;
  string a ;
  cin >> a ;
  stack < int > st ;

  int pa = 0 ;
  vector < int > ok ;
  vector < string > arr;
  for ( int i = 0 ; i < a.size() ; i ++){
    if ( a[i]=='('||a[i]==')'){
            st.push(i);
            ok.push_back(i);

        }
  }

  while(!st.empty()){
     int y = st.top();
     st.pop();
     int x = st.top();
     st.pop();
     string p ;
     for ( int i = x + 1 ; i < y ; i ++){
        if ((a[i]>='a'&&a[i]<='z')||(a[i]>='A'&&a[i]<='Z')){

                p+=a[i];
        }
        else {
            // cout << p <<endl;
                 arr.push_back(p);
                p="";
                continue;
        }

     }
     arr.push_back(p);

  }
  int cnt = 0 ;
  for ( int i = 0 ; i < arr.size() ; i++){
    if ( arr[i]!="")cnt++;

  }
  int u = 0 ;
  string m ;
  for ( int i = 0 ; i < ok.size()  ; i ++ ){
     int x = ok[i];
     int y = ok[i+1];
     for ( int j = u ; j < a.size() ; j ++){
        if ( j == y) {
            break;
        }
       if ( j >=x&& j<=y)continue;
       else m+=a[j];
     }
     u = y + 1;
     i++;
  }
  int t ;
  if (ok.size() >0) t = ok[ok.size() - 1];
  m+='_';
  for ( int i = t+1 ; i < a.size() ;  i++){
    m+=a[i];
  }
  arr.clear();
  string p ;
  if ( ok.size() ==0) m  =a;
   for ( int i = 0 ; i < m.size() ; i ++){
        if ((m[i]>='a'&&m[i]<='z')||(m[i]>='A'&&m[i]<='Z')){

                p+=m[i];
        }
        else {
            // cout << p <<endl;
                arr.push_back(p);
                p="";
                continue;
        }

     }
     arr.push_back(p);
     int pl =0 ;
     int mx = 0 ;

     for ( int i = 0 ; i < arr.size() ; i++){
           string  p  = arr[i];
          // cout << arr[i]<<" ";
           if ( p!="")  pl = p.size();
            if ( pl > mx ){
                mx = pl;
            }

  }
 cout << mx <<" "<<cnt <<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define REP(n) for(int i=0;i<n;i++)
#define lld unsigned long long int
#define mem(a,d) memset(a,d,sizeof(a))

bool isUpperCase(char c){return c>='A' && c<='Z';}
bool isLowerCase(char c){return c>='a' && c<='z';}
bool isLetter(char c){return c>='A' && c<='Z' || c>='a' && c<='z';}
bool isDigit(char c){return c>='0' && c<='9';}

void CALL(){
    int N;
    cin>>N;
    string S;
    cin>>S;
    vector<int>A;
    vector<int>B;
    int C=0,F=0;
    int Ans1=0;
    int P=0;
    for(int i=0;i<S.size();i++){
        if(S[i]=='('){
            if(C>0){
                Ans1=max(Ans1,C);
                C=0;
            }
            P=1;
        }
        if(S[i]==')'){
            P=0;
        }
        if(!P){
            if(isLetter(S[i])){
                C++;
            }else{
               // A.push_back(C);
                Ans1=max(Ans1,C);
               // cout<<C<<" "<<i<<endl;
                C=0;

            }
        }
    }
    Ans1=max(Ans1,C);
    int Ans2=0;
    F=0;
    REP(S.size()){
        if(S[i]=='_' && C>0 && F){
            Ans2++;
            C=0;
        }
        if(S[i]==')'){
            if(C>0){
                Ans2++;
            }
            F=0;
        }
        if(F && S[i]!='_'){
            C++;
        }
        if(S[i]=='('){
            F=1;
        }

    }
    cout<<Ans1<< " "<< Ans2<<endl;
}
void CASE(){
    while(1){
        CALL();
    }
}
int main()
{
    CALL();
    //CASE();
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
const int N = 1e5 * 2 + 1;
const int inf = 1e9 + 7;
int main () {
	int n;
	cin >> n;
	string s;
	cin >> s;
	string cur;
	int cnt = 0;
	int mx  = 0;
	for (auto it : s) {
		if (it == '(' || it == ')' || it == '_') {
			if (!cur.empty()) {
				mx = max(mx, (int) cur.size());
				cnt++;
			}
			cur.clear();
		}
		else cur.push_back(it);
	}
	if (!cur.empty()) {
		mx = max(mx, (int) cur.size());
		cnt++;
	}
	cout << mx;
	cout << ' ';
	cout << cnt << endl;
}

#include <iostream>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <bitset>
#include <ctime>
#pragma comment(linker, "/STACK:256000000")
using namespace std;

#define in(s) freopen(s, "r", stdin)
#define out(s) freopen(s, "w", stdout)
#define forn(i, n) for (int i = 0; i < n; i++)
#define endl '\n'

typedef long long ll;
typedef long double ld;

int main()
{
	//in("input.txt");
	//out("output.txt");
	srand(1373737);
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	int n;
	cin >> n;

	string s, cur = "";
	cin >> s;

	bool ins = false;
	int ans1 = 0, ans2 = 0;
	forn(i, n)
	{
		if (s[i] == '_')
		{
			if (!ins)
				ans1 = max(ans1, (int)cur.size());
			else
				ans2 += (cur.size() > 0);
			cur = "";
			continue;
		}
		if (s[i] == '(')
		{
			ans1 = max(ans1, (int)cur.size());
			ins = true;
			cur = "";
			continue;
		}
		if (s[i] == ')')
		{
			ans2 += (cur.size() > 0);
			ins = false;
			cur = "";
			continue;
		}
		cur += s[i];
	}

	cout << ans1 << " " << ans2 << endl;

	return 0;
}

#include <bits/stdc++.h>
#include<map>
using namespace std;
typedef long long ll;
//const int N = 1e5 + 1;
map<int, int >frqA;
map<int, int >frqB;
int A = 100;
vector<ll >v;
int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
#endif

	int x;
	cin >> x;
	int mx = 0, l=0, c = 0;
	string s;
	cin >> s;

	for (int i = 0; i < x; i++) {
		if (s[i] == '(')
			for (int j = i + 1; s[j] != ')'; j++) {

				if ((isalpha(s[j]))) {
					if (s[j+1] == '_'&& isalpha( s[j]) || s[j+1] == ')')
				c++;
				}
				if (s[j + 1] == ')')
					i = j + 1;
			}

	}
	for (int i = 0; i < x; i++) {
		if (s[i] == '(')
			for (int j = i + 1; s[j] != ')'; j++) {
				if (s[j + 1] == ')')
					i = j + 1;
			}

		else if (isalpha(s[i])) {
			l++;
		}
		else if (s[i] == '_') {
			mx = max(mx, l);
			l = 0;
		}
	}
	cout << mx<< " " << c << endl;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;
const int N = 1e5 * 2 + 1;
const int inf = 1e9 + 7;
int main () {
	int n;
	cin >> n;
	string s;
	cin >> s;
	string cur;
	int cnt = 0;
	int mx  = 0;
	for (auto it : s) {
		if (it == '(' || it == ')' || it == '_') {
			if (!cur.empty()) {
				mx = max(mx, (int) cur.size());
				cnt++;
			}
			cur.clear();
		}
		else cur.push_back(it);
	}
	if (!cur.empty()) {
				mx = max(mx, (int) cur.size());
		cnt++;
	}
	cout << mx << ' ' << cur;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	string str;
	cin>>n>>str;
	int par=0,lenout=0,len=0;
	int i=0;
	while(str[i]=='_')i++;
	int flag;
	for(;i<n;i++)
	{
		if(str[i]=='(')
		{
			//cout<<i<<"\n";
			i++;
			while(str[i]=='_')i++;
			flag=0;
			while(str[i]!=')')
			{
				while(i<n && str[i]=='_'){if(flag)par++;flag=0;i++;}
				while(i<n && (str[i]>='a'&&str[i]<='z') || (str[i]>='A'&&str[i]<='Z')){flag=1;i++;}
				//cout<<i<<"\n";
			}
			if(flag)par++;
			len=0;
			//cout<<par<<"\n";
			//cout<<i<<"\n";
		}
		else
		{
			if((str[i]>='a'&&str[i]<='z') || (str[i]>='A'&&str[i]<='Z'))
				len++;
			else
			{
				lenout=max(lenout,len);
				len=0;
			}
		}
		//cout<<i<<"\n";
	}
	lenout=max(lenout,len);
	cout<<lenout<<" "<<par<<"\n";
	return 0;
}

#include<bits/stdc++.h>
#define pb(a,b) a.push_back(b)
using namespace std;
typedef long long ll;
int main()
{
    ll l,i,c,f=0,mx=0,sz,j;
    vector<string>v1,v2;
    vector<ll>vv;
    string s,now;
    cin>>l;
    getchar();
    cin>>s;
    for(i=0; i<l; i++)
    {
        if(s[i]==')'||s[i]=='(')pb(vv,i);
    }
    sz=vv.size();
    //cout<<sz<<endl;
    for(i=0; i<sz; i+=2)
    {
        ll st=vv[i]+1;
        ll ed=vv[i+1]-1;
        for(j=st; j<=ed; j++)
        {
            if(s[j]=='_')
            {
                if(now.size())
                    pb(v2,now);
                now.clear();
            }
            else
            {
                now+=s[j];
            }
            //cout<<v2.size()<<endl;
        }
        if(now.size())pb(v2,now),now.clear();

    }
    now.clear();

    for(j=0; j<vv[0]; j++)
    {
        if(s[j]=='_')
        {
            if(now.size())
            {
                pb(v1,now);
                mx=max(mx,(ll)now.size());
            }
            now.clear();
        }
        else
        {
            now+=s[j];
        }
    }
    if(now.size())pb(v1,now),now.clear();

    for(i=1; i<sz-1; i+=2)
    {
        ll st=vv[i]+1;
        ll ed=vv[i+1]-1;
        for(j=st; j<=ed; j++)
        {
            if(s[j]=='_')
            {
                if(now.size())
                {
                    pb(v1,now);
                    mx=max(mx,(ll)now.size());
                }
                now.clear();
            }
            else
            {
                now+=s[j];
            }
        }
        if(now.size())pb(v1,now),now.clear();

    }

    for(j=vv[vv.size()-1]; j<l; j++)
    {
        if(s[j]=='_')
        {
            if(now.size())
            {
                pb(v1,now);
                mx=max(mx,(ll)now.size());
            }
            now.clear();
        }
        else
        {
            now+=s[j];
        }
    }
    if(now.size())pb(v1,now),now.clear();

    cout<<mx<<" "<<v2.size();
    return 0;
}

#include <bits/stdc++.h>

int main()
{
    int n;
    std::cin>>n;
    std::string v;
    std::cin>>v;
    int max_length=0;
    int length=0;
    bool run=true;
    for (int i=0;i<n;i++){
        if (v.at(i)=='(')
            run=false;
        if (v.at(i)==')'){
            run=true;
            continue;
        }
        if (!run)
            continue;
        if (v.at(i)=='_')
            length=0;
        else{
            length++;
            max_length=std::max(length,max_length);
        }
    }
    std::cout<<max_length<< " ";
    while (v.find("__")!=std::string::npos){
        v.erase(v.begin()+v.find("__"));
    }

    while (v.find("(_)")!=std::string::npos){
        v.erase(v.begin()+v.find("(_)"),v.begin()+v.find("(_)")+3);
    }

    bool work=false;
    int result=0;
    int counter=0;

    for (int i=0;i<v.size();i++){
        if (v.at(i)=='('){
            work=true;
            counter=0;
        }
        else if (v.at(i)==')'){
            work=false;
            std::cout<<"\n"<<counter<<"\n";
            result+=counter+1;
        }
        if (work){
            if (v.at(i)=='_'&&v.at(i-1)!='('&&(v.at(i+1)!=')'))
                counter++;
        }
    }
    std::cout<<result;
}

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lli long long
#define mp make_pair
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()
#define MOAE                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
bool ifchar(char c)
{
    for (char i = 'a'; i <= 'z'; i++)
    {
        if (c == i)
            return true;
    }
    for (char i = 'A'; i <= 'Z'; i++)
    {
        if (c == i)
            return true;
    }
    return false;
}
int main()
{
    int n, mxin = 0, mxout = INT_MIN, cnt = 0;
    bool f = false, fi;
    cin >> n;
    string s;
    cin >> s;
    vector<string> out, in;
    string temp = "";
    for (int i = 0; i < n; i++)
    {

        if (s[i] != '(')
        {
            temp += s[i];
        }
        else
        {
            out.push_back(temp);
            string tempi = "";
            int j;
            for (j = i;; j++)
            {
                if (s[j] != ')')
                    tempi += s[j];
                else
                {
                    in.push_back(tempi);
                    break;
                }
            }
            i = j;
            temp = "";
        }
    }
    for (auto it : in)
    {
        for (int i = 1; i <= it.size(); i++)
        {
            if (ifchar(it[i]))
            {
                f = true;
                continue;
            }
            else
            {
                if (f)
                {
                    mxin++;
                    f = false;
                }
            }
        }
    }
    for (auto it : out)
    {
        for (int i = 0; i < it.size(); i++)
        {
            if (ifchar(it[i]))
                cnt++;
            else
            {
                mxout = max(mxout, cnt);
                cnt = 0;
            }
        }
    }
    if (mxout == INT_MIN)
        cout << 0 << " " << mxin;
    else
        cout << mxout << " " << mxin << endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int i,j,k,koyta;
    char str[500],store[500];

    while(scanf("%d",&koyta)==1)
    {

    getchar();

    scanf("%s",&str);
    int ltr=0;
    int cnt=0;
    int bkt=0;
    int mx_length=0;
    k=0;

    for(i=0; i<koyta; i++)
    {
        if(str[i]=='_')
        {
            if(ltr==0)
            {
                k=0;
                ///store[k++]=str[i];
            }
            else if(ltr==1)
            {
                store[k++]='_';
                store[k]='\0';
                ///puts(store);
                if(mx_length<(k-1) && bkt==0)
                {
                    mx_length=k-2;
                }
                if(bkt==1)
                {
                    cnt++;
                }
                k=0;
            }
            ltr=0;
            store[k++]=str[i];
        }
        else if(str[i]=='(')
        {
            bkt=1;
            if(ltr==0)
            {
                k=0;
                ///store[k++]=str[i];
            }

            else if(ltr==1)
            {
                store[k++]='(';
                store[k]='\0';

                if(mx_length<(k-1))
                {
                    mx_length=k-2;
                }
                ///puts(store);
                k=0;
            }
            ltr=0;
            store[k++]=str[i];
        }
        else if(str[i]==')')
        {
            if(ltr==0)
            {
                k=0;
                ///store[k++]=str[i];
            }

            else if(ltr==1)
            {
                store[k++]=')';
                store[k]='\0';
                cnt++;
                ///puts(store);
                k=0;
            }
            ltr=0;
            store[k++]=str[i];
            bkt=0;

        }

        else if(((str[i]>='a' && str[i]<='z') || (str[i]>='A' || str[i]<='Z')))
        {
            store[k++]=str[i];
            ltr=1;
            if(i==koyta-1)
            {
                store[k]='\0';
                if(mx_length<k-1)
                {
                    mx_length=k-1;
                }
            }
        }
    }

    cout<<mx_length<<" "<<cnt<<endl;

    }

    return 0;
}

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int flag = 0, ct = 0, d = 1;
    for(int i = 0; i < s.length(); i++){
        if(s[i] == '('){
            flag = 1;
        }else if(flag && s[i] == '_' && !d){
            ct++;
            //cout << i << endl;
            d=1;
        }else if(flag && s[i] != '_' && s[i] != ')'){
            d=0;

        }else if(s[i] == ')'){
            if(d==0){
                ct++;
            }
            flag = 0;
        }
    }
    int ans = 0, c2 = 0;
    for(int i = 0; i < s.length(); i++){
        if(s[i] == '('){
            flag = 1;
        }else if(!flag && s[i] == '_'){
            ans = max(ans,c2);
            c2 = 0;
        }else if(!flag && s[i] != '_' && s[i] != ')'){
            c2++;
        }else if(s[i] == ')'){
            flag = 0;
        }
    }
    ans = max(ans,c2);
    cout << ans << " " << ct << endl;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    cin.ignore();
    string check;
    getline(cin,check);
    stack<char> y,br;
    string str[100],x,brace;
    int count=0,a[100];
    int count2=0;
    for(int i=0;i<check.length();i++){
        if(y.empty()&&(check[i]=='_'||check[i]==')'||check[i]=='(')&&br.empty())
        {
            y.push(check[i]);
        }
        if(!y.empty()&&!x.empty()&&(check[i]=='_'||check[i]==')'||check[i]=='(')&&br.empty())
        {
            str[count++]=x;
            x.clear();
            while(!y.empty())
            y.pop();
            y.push(check[i]);
        }
        if(check[i]>=65&&check[i]<=90&&!y.empty()&&br.empty())
        {
            x=x+check[i];
        }
        if(check[i]>=97&&check[i]<=122&&!y.empty()&&br.empty())
        {
            x=x+check[i];
        }

        if(br.empty()&&check[i]=='(')
           {
               br.push(check[i]);
           }
        if(check[i]==')')
        {
            if(!brace.empty()){
            count2++;
            brace.clear();
            }
            while(!br.empty())
                br.pop();
        }
        if(check[i]=='_'&&!br.empty())
        {
            if(!brace.empty()){
            count2++;
            brace.clear();
            }
        }
        if(check[i]>=65&&check[i]<=90&&!br.empty())
        {
            brace=brace+check[i];
        }
        if(check[i]>=97&&check[i]<=122&&!br.empty())
        {
            brace=brace+check[i];
        }
    }
    if(count>0){
    for(int j=0;j<count;j++)
    {
        //cout<<str[j]<<endl;
        a[j]=str[j].length();
    }
    sort(a,a+count,greater<int>());
    }
    else
        a[0]=0;
    cout<<a[0];
    cout<<" "<<count2<<endl;

    return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n,i,j;
    scanf("%d",&n);
    char s[555];
    scanf("%s",s);
    int len = strlen(s);
    int ans1=0;
    int tem=0;
    for(i=0;i<len;i++)
    {
        if(s[i]=='(')
        {
            ans1=max(ans1,tem);
            tem=0;
            for(j=i+1;j<len;j++)
            {
                if(s[j]==')')
                {
                    i=j;
                    break;
                }
            }
        }
        else if(s[i]=='_')
        {
            ans1=max(ans1,tem);
            tem=0;
        }
        else tem++;
    }
    ans1=max(ans1,tem);
    printf("%d",ans1);

    int ans2=0;
    tem=0;
    bool flag=false;
    for(i=0;i<len;i++)
    {
        if(s[i]=='(')
        {
            ans2++;
            for(j=i+1;j<len;j++)
            {
                if(s[j]!='_'&&s[j]!='('&&s[j]!=')')flag=true;
                if(s[j]==')')
                {
                    i=j;
                    break;
                }
                else if(s[j]=='_'&&s[j-1]!='_'&&s[j+1]!=')'&&s[j-1]!='(')
                {
                    ans2++;
                }
            }
            if(!flag)ans2--;
        }
    }
    printf(" %d\n",ans2);

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	string str;
	cin>>n>>str;
	int par=0,lenout=0,len=0;
	int i=0;
	while(str[i]=='_')i++;
	int flag;
	for(;i<n;i++)
	{
		//cout<<str[i]<<"\n";
		if(str[i]=='(')
		{
			i++;
			while(str[i]=='_')i++;
			flag=0;
			while(str[i]!=')')
			{
				while(str[i++]=='_'&& flag){par++;flag=0;}
				while(str[i]!='_' && str[i]!=')'){flag=1;i++;}
			}
			if(str[i]==')' && str[i-1]!='(' && str[i-1]!='_')par++;
			len=0;
		}
		else
		{
			if((str[i]>='a'&&str[i]<='z') || (str[i]>='A'&&str[i]<='Z'))
				len++;
			else
			{
				lenout=max(lenout,len);
				len=0;
			}
		}
	}
	lenout=max(lenout,len);
	cout<<lenout<<" "<<par<<"\n";
	return 0;
}

////////////////////////////////////////////
//   Name: Tanveer Zilani Hridoy          //
//  Jahangirnagar University,Dept. of CSE //
//          CF,UVA-t_zilani               //
////////////////////////////////////////////
#include<cfloat>
#include<climits>
#include<fstream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<map>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>

#define ll long long
#define ull unsinged long long
#define pi 2*acos(0.0)

#define sc1(x) scanf("%lld",&x)
#define sc2(x1,x2) scanf("%lld%lld",&x1,&x2)
#define sc3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define sci1(x) scanf("%d",&x)
#define sci2(x1,x2) scanf("%d%d",&x1,&x2)
#define sci3(a,b,c) scanf("%d%d%d",&a,&b,&c)

#define pb(x) push_back(x)
#define mem(a,z) memset(a,z,sizeof(a))
#define MINUS(a) memset(a,-1,sizeof(a))
#define MP make_pair(a,b)
#define pii(a) pair<int,int>a
#define pll(a) pair<long long,long long>a
#define nl puts("")

#define pcase(ca) printf("Case %d: ",ca++);
#define mxx 100010
using namespace std;

vector<int>open,close;

int main ()
{
    string s;
    int len,bra,st,ed,n,mx,cnt,fl;
    cin>>n>>s;

    len=s.size();

    fl=1;
    for(int i=0; i<len; i++)
    {
        if(s[i]=='(') open.pb(i);
        if(s[i]==')') close.pb(i);
    }

    bra=0;
    for(int i=0; i<open.size(); i++)
    {
        st=open[i];
        ed=close[i];
        //  cout<<st<<" "<<ed<<endl;
        for(int j=st+1; j<ed; j++)
        {
            if(((s[j]>='a' && s[j]<='z') || (s[j]>='A' && s[j]<='Z')) && (s[j+1]=='_' || s[j+1]==')'))
            {
                bra++;
                // cout<<s[j]<<" ";
            }
        }
    }

    mx=-1;
    int j;
    cnt=0;
    for(int i=0; i<len; i++)
    {
        if(s[i]=='(')
        {
            for(j=i;j<len;j++)
            {
                //cout<<s[j]<<" ";
                if(s[j]==')') break;
            }
            //nl;
            //cout<<j<<endl;
            i=j;
        }
        else
        {
            if((s[i]>='a' && s[i]<='z')||(s[i]>='A' && s[i]<='Z'))
            {
                cnt=0;
                for(j=i;j<len;j++)
                {
                    //cout<<s[j]<<" ";
                    if(s[j]=='_' || s[j]=='(' || s[j]==')') break;
                    else cnt++;
                }
              //  nl;
                i=j;
                mx=max(mx,cnt);
            }
        }
    }
    //nl;
    mx=max(mx,cnt);
    //nl;

    cout<<max(0,mx)<<" "<<bra<<endl;

    return 0;
}

#include <iostream>

using namespace std;

int max(int, int);

int main(){

	int n,len=0, maxlen=0, words=0;
	char c;
	bool paren=0;
	cin >> n;
	for(int i=0; i<n; i++){
		cin >> c;
		//cout << c  << " " << words << endl;

		if(c == '_'){
			maxlen = max(maxlen,len);
			len = 0;
			if(paren) words++;
		}else if(c == '('){
			maxlen = max(maxlen,len);
			len = 0;
			paren = 1;
		}else if(c == ')'){
			words++;
			paren = 0;
		}else{
			len++;
		}
	}
	cout << maxlen << " " << words << endl;

	return 0;
}

int max(int a, int b){
	if(a>b)
		return a;
	return b;
}

/*
*author : alfarelzaki
*created : 12.05.2019
*/
#include <bits/stdc++.h>
using namespace std;

int main (){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int n, ct=0, mx=0, ctl=0;
	bool par=0, word=0;
	string s;
	cin >> n >> s;
	for (int i=0; i<n; i++) {
		if (s[i]=='('){
			par=1;
			word=0;
			continue;
		} else if (s[i]==')') {
			par=0;
			word=0;
			continue;
		}

		if (par==1) {
			if (word==0 && s[i]!='_') {
				word=1;
				ct++;
			} else if (s[i]=='_') word=0;
		} else {
			if (s[i]!='_') ctl++;
			else {
				mx = max(mx, ctl);
				ctl=0;
			}
		}
	}
	mx = max(mx, ctl);

	cout << mx << ' ' << ct << "\n";
}

#include <bits/stdc++.h>
using namespace std;

int n;
int cnt, ma;
string s, buf;
map<string, int> w;
bool bracket;

int main() {
	cin >> n >> s;
	for(int i = 0; i < n; i++) {
		if(s[i] == '(') {
			bracket = true; buf = "";
		} else if(s[i] == ')') {
			bracket = false;
			if(buf.size()) cnt++;
			buf = "";
		} else if(s[i] == '_' && bracket) {
			if(buf.size()) cnt++;
			buf = "";
		} else if(s[i] == '_' && ! bracket) {
			ma = max((int) buf.size(), ma);
			buf = "";
		} else {
			buf += s[i];
		}
	}
	if(bracket) {
		if(buf.size()) cnt++;
	} else if(buf.size()){
		ma = max((int) buf.size(), ma);
	}
	cout << ma << " " << cnt;
}

/* Bismillahir rahmanir rahim */
//#pragma comment(linker, "/STACK:36777216")

#include <bits/stdc++.h>

using namespace std;

#define pi          acos(-1.0)
#define eps         1e-9

#define rep(i, n)       for(int i = 0; i < (n); i++)
#define reps(i, a, b)   for(int i= (a); i <= (b); i++)
#define fill(a, v)      memset(a, v, sizeof (a))
#define pb              push_back
#define pf              push_front
#define mp              make_pair
#define all(a)          (a).begin(),(a).end()

template<class T> inline T gcd(T a, T b)    { return b == 0 ? a : gcd(b, a % b); }
template<class T> inline T lcm(T a, T b)    { return (a / gcd(a, b)) * b; }

typedef long long int LL;
typedef long double LD;
typedef vector<int> VI;

#define siz         3001
#define MAX_N       100000009
//int diri[] = {0, 1, 0, -1, -1, 1, 1, -1};
//int dirj[] = {1, 0, -1, 0, 1, 1, -1, -1};

int main(){
    //clock_t start = clock();
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    //#ifndef ONLINE_JUDGE
    //    freopen("in.txt","r",stdin);
    //    freopen("output.txt","w",stdout);

    string s;
    int n;

    cin >> n >> s;

    int out = 0;
    int in = 0;

    for(int i = 0; i < n; i++) {

        if( (s[i] == '(' ) || (s[i] == '{' ) || (s[i] == '[' )) {
            //cout << s[i] << endl;
            int flag = 0;
            for(int j = i + 1; j < n; j++) {
                if( (s[j] >= 'a' && s[j] <= 'z') || (s[j] >= 'A' && s[j] <= 'Z' ) ) {
                    flag = 1;
                }
                else if( ( s[j] == '_' ) && flag ) {
                    ++in;
                    flag = 0;
                }
                if( s[j] == ')' || (s[i] == '}' ) || (s[i] == ']' ) ) {
                    if( flag )
                        ++in;
                    i = j - 1;;
                    //cout << "i = " << i << endl;
                    break;
                }
            }
        }

        if( s[i] == '_' ) {
            int flag = 0;
            int cnt = 0;
            for(int j = i + 1; j < n; j++) {
                if( (s[j] >= 'a' && s[j] <= 'z') || (s[j] >= 'A' && s[j] <= 'Z' ) ) {
                    flag = 1;
                    ++cnt;
                }

                else if( s[j] == '_' && flag ) {
                    out = max(out, cnt);
                    cnt = 0;
                }

                if( s[j] == '(' ) {
                    if( cnt ) {
                        out = max( out, cnt );
                    }
                    i = j - 1;
                    //cout << "i = " << i << endl;
                    break;
                }
            }
        }
        //cout << "i = " << i << endl;
    }
    cout << out << " " << in << endl;

    //#endif
    //clock_t final = clock()-start;
    //cerr<<endl<<final/ (double) CLOCKS_PER_SEC<<endl;
    return 0;
}

#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>

using namespace std;

int main() {

	int n;
	cin>>n;
	int a=0,b=0;
	int r=0;
	int x=0,y=0;
	bool f=0;
	int p=0;
	for(int i=0;i<n;i++){
		char t;
		cin>>t;
		if(t=='_'){
			if(!r)f=1;
			b=0;
			//if(i>p+1&&r==0)x++;
			p=i;
		}
		else if(t=='('){r++,b=0;if(f)x++,f=0;}
		else if(t==')'){r--,b=0;if(f)x++,f=0;}
		else{
			if(f||b||!r){
				b++;
			}
			if(f)f=0,x++;
		}
	y=max(y,b);
	}
	cout<<y<<" "<<x<<endl;

	return 0;
}

//SIRIUSLIGHT-> SIRIUS-BRIGHTEST STAR IN UNIVERSE
//           -> LIGHT-LIGHT OF SIRIUS
#include <bits/stdc++.h>
using namespace std;

typedef long long i64;
typedef unsigned long long ui64;

vector<i64> v1;
vector<i64> v2;
vector<pair<i64, i64> > vp;
int main()
{ios_base::sync_with_stdio(0);
 i64 n,i,j; string s;
 cin>>n;
 char a[n+1];

 cin>>a; int f=0;
 i64 h[n]={0};  i64 ctr1=0;
 i64 xtr=0;
 i64 ctr=0; int f1=0; i64 ans1=0;
 for(i=0;i<n;i++)
 { if(a[i]=='(')
     {f=1;
     f1=1;
     xtr=0;
	 }
     else if(a[i]==')')
     {f=0;
      xtr=0;
	 }

     else if(f==1)
     {
       if(isalpha(a[i]) && f1==1)
 	  {
 	 	ctr++;
 	 	f1=0;
	  }
	  if(a[i]=='_')
	  f1=1;

	 }

	 else if(f==0)
	 {
	 	if(isalpha(a[i]))
	 	xtr++;
	 	else
	 	{ if(ans1<xtr)
		  ans1=xtr;
	 	 xtr=0;
		 }

	 }

 }

 if(ans1<xtr)
 ans1=xtr;
i64 ans2=ctr;
if(ans1<0)
ans1=0;
cout<<ans1<<" "<<ans2;
 return 0;
}

#include<bits/stdc++.h>
using namespace std;

bool bracket=false;

int longest_out(string & str)
{
    int maxs=0,current=0;
    for(int i=0;i<str.size();i++){
        if(str[i]=='('){
            bracket=true;
            maxs=max(maxs,current);
            current=0;
           }
        else if(str[i]==')'){
            bracket=false;
        }
        else if(str[i]=='_'){
            if(bracket==true) continue;
            else{
                maxs=max(maxs,current);
            }
            current=0;
        }
        else{
            if(bracket==true) continue;
            else current++;
        }
    }

   // maxs=max(maxs,current);

    return maxs;

}

int word_in(string & str)
{
  int total=0,cnt=0;
  for(int i=0;i<str.size();i++){
     if(str[i]=='('){
        bracket=true;

     }
     else if(str[i]==')'){
        bracket=false;
        if(cnt>0){
            total++;
        }
        cnt=0;
     }
     else if(str[i]=='_'){
        if(bracket==true){
            if(cnt>0){
                total++;
            }
            cnt=0;
        }
     }
     else{
         if(bracket==true){
            cnt++;
         }
     }
  }

  return total;

}

int main()
{
    ios::sync_with_stdio(false);
    int n,ans1,ans2;
    cin>>n;
    string str;
    cin>>str;
    ans1=longest_out(str);
    ans2=word_in(str);
    cout<<ans1<<" "<<ans2<<endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
const int N = 1e5 * 2 + 1;
const int inf = 1e9 + 7;
int main () {
	int n;
	cin >> n;
	string s;
	cin >> s;
	string cur;
	int cnt = 0;
	int mx  = 0;
	for (auto it : s) {
		if (it == '(' || it == ')' || it == '_') {
			if (!cur.empty()) {
				mx = max(mx, (int) cur.size());
				cnt++;
			}
			cur.clear();
		}
		else cur.push_back(it);
	}
	if (!cur.empty()) {
		mx = max(mx, (int) cur.size());
		cnt++;
	}
	cout << mx;
	cout << ' ';
	cout << cnt << endl;
}

#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	int l=s.length();
	string temp="";
	int max=-1,y=0;
	for (int i = 0; i < l; ++i)
	{
		//	 cout<<temp<<"\n";
		// y=temp.length();
		// if(y >= max)
		// {
		// 	// cout<<"yes";
		// 	max=y;
		// }
		if(s[i]=='(')
		{
			y=temp.length();
			if(y>max)
				max=y;
			temp="";
			while(s[i]!=')')
				i++;
			i++;
		}
		if(s[i]!='_')
		{
			temp=temp+s[i];
		}
		if(s[i]=='_' || i==l-1)
		{
			int y=temp.length();
			if(y>max)
				max=y;
			temp="";
		}
		/* code */
	}
	int count=0,flag=0;
	temp="";
	for (int i = 0; i < l; ++i)
	{
		if(s[i]=='(')
		{
			flag=1;
			continue;
		}
		else if(s[i]==')')
		{
			if(temp.length()>0)
					count++;
			temp="";
			flag=0;
			continue;
		}

		if(flag==1)
		{
			if(s[i]!='_')
			{
				temp+=s[i];
			}
			else
			{
				if(temp.length()>0)
					count++;
				temp="";
			}
		}
		/* code */
	}
	cout<<max<<" "<<count<<endl;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int i,j,k = 0,m,n,t, p =0, len, len1, len2, l;
    string str, str1, str2, str3;
    cin >> len;
    getchar();
    getline(cin, str);
    //cout << str << endl;
    for(i=0; i<len; i++)
    {
        if(str[i] == '(' || p == 1)
        {
            k = 1;
            p = 1;
            str2 += str[i];
        }
        if(p == 0)
        {
            str1 += str[i];
        }
        if(str[i] == ')')
        {
            k = 1;
            str2 += str[i];
            p =0;
        }
    }
    len1 = str1.size();
    len2 = str2.size();
    l = 0;
    for(i=0; i<len1; i++)
    {

      if(str1[i] == '_')
      {
          t = str3.size();
          l = max(l,t);
          str3.clear();
      }
      else
      {
          str3 += str1[i];
      }
    }
    if(str3.size()>l)
    {
        l = str3.size();
    }
    str3.clear();
    p =0;
    int cnt =0;
    for(i=0; i<len2; i++)
    {
        if((str2[i]>= 'A' && str2[i] <= 'Z') || ( str2[i]>= 'a' && str2[i] <= 'z'))
        {
            str3+= str2[i];
        }
        if(str2[i] == '_' || str2[i] == ')')
        {
            if(str3.size() > 0)
            {
                str3.clear();
                cnt++;
            }
        }
    }
    if(k == 0) cout << 0 << " " << 0 << endl;
    else
    cout << l << " " << cnt << endl;
}

#include<stdio.h>
#include<math.h>
#include<iostream>
using namespace std;
char s[1005];
int main()
{
    int n;
    int maxlength;
    int currlength;
    bool in;
    int num;
    while(scanf("%d",&n)!=EOF)
    {
        scanf("%s",s);
        maxlength = 0;currlength = 0;
        in = 0;num = 0;
        for(int i  = 0 ; i < n;i++)
        {
            if(s[i]=='_')
            {
                if(in)
                {
                    if(currlength>0)
                        num++;
                }
                else
                {
                    maxlength = max(currlength,maxlength);
                }
                currlength = 0;
            }
            else if(s[i]=='(')
            {
                in = 1;
                maxlength = max(currlength,maxlength);
                currlength = 0;
            }
            else if(s[i]==')')
            {
                in = 0;
                if(currlength>0)
                    num++;
                currlength= 0;
            }
            else
            {
                currlength++;
            }
        }
        cout<<maxlength<<" "<<num<<endl;

    }
}

#include<bits/stdc++.h>
using namespace std;
int a[10000];
int  strr(string s)
{
    int cnt = 0;
    string r = "";
    s += "_";
    bool ok = 1;
    for(int i = 0; i < s.size(); i ++)
    {
        if(s[i] == '_' and r.size() != 0)
        {
                cnt ++;
                r = "";
        }
       else if(s[i] != '_')
        {
            r += s[i];
        }
    }
    return cnt;
}
int strr1(string s)
{
    int cnt = 0;
    string r = "";
    s += "_";
    for(int i = 0; i < s.size(); i ++)
    {
        if(s[i] =='_' and r.size() != 0)
        {
            cnt = max(cnt,(int)(r.size()));
            r = "";
        }
        else if(s[i] != '_')
        {
            r += s[i];
        }
    }
    return cnt;
}
main()
{
    int n ,ans = 0,id = 0;
    cin >> n;
    string s, w = "",ss = "";
    cin >> s;

    for(int i = 0; i < s.size(); i ++)
    {

        if(s[i] == '(')
        {
            id = max(id,strr1(ss));
            ss = "";
            int k = i;
            for(int j = k + 1; ; j ++)
            {
                i ++;
                if(s[j] == ')')
                {
                    // cout << w << "   ";
                    ans += strr(w);
                    w = "";
                    break;
                }
                else
                {
                    w += s[j];
                }
            }
        }
        else
        {
            ss += s[i];
        }
    }
    cout << id << "  " << ans;
}

#include<bits/stdc++.h>
using namespace std;
vector<char> vec1;
vector<char> vec2;
char str[500];
int main(){
    vec1.clear();
    vec2.clear();
    int num;
    scanf("%d",&num);
    scanf("%s",str);
    //cout<<strlen(str)<<endl;
    int count=0;
    for(int i=0;i<num;i++){
        if(str[i]=='('){
            count++;
            vec1.push_back('(');
            vec2.push_back('(');
            continue;
        }
        else if(str[i]==')'){
            count--;
            vec1.push_back(')');
            vec2.push_back(')');
            continue;
        }
        if(count==0){
            vec1.push_back(str[i]);
        }
        else{
            vec2.push_back(str[i]);
        }
    }
    int ans=0,tmp=0;
    for(int i=0;i<vec1.size();i++){

        tmp=0;
        while((vec1[i]>='a'&&vec1[i]<='z')||(vec1[i]>='A'&&vec1[i]<='Z')){

            tmp++;
            i++;
        }
        ans=max(ans,tmp);
    }
    cout<<ans<<" ";
    count=0;
    for(int i=0;i<vec2.size();i++){
        if((vec2[i]>='a'&&vec2[i]<='z')||(vec2[i]>='A'&&vec2[i]<='Z')){
            count++;
            while((vec2[i+1]>='a'&&vec2[i+1]<='z')||(vec2[i+1]>='A'&&vec2[i+1]<='Z')){
                i++;
            }
        }
    }
    cout<<count<<endl;//
    return 0;
}

#include<bits/stdc++.h>

using namespace std ;

#define ll long long int
#define fr(i,n) for ( int i = 1 ; i <= n ; i++ )
#define pb push_back
#define pf push_front
#define CO(a) cout << a ; exit(0) ;
#define FOR(a,b,c) for ( int i = a ; i <= b ; i+=c )
const long long int INF = 1e9 ;
const int N = 2e5+2 ;

int n , mx = -INF , cnt , lnt , mn = -INF ;
string s ;
int main ()
{
    cin >> n >> s ;
    for ( int i = 0 ; i < s.size() ; i++ )
    {
        if ( s[i] == '(' )
        {
            for ( int j = i ; j < s.size() ; j++ )
            {
                if ( s[j] == ')' )
                {
                    i = j ;
                    break ;
                }
            }
        }
        else
        {
            int t = i ;
            while ( s[t] != ')' and s[t] != ')' and s[t] != '(' )
            {
                t++ ;
                cnt++ ;
            }
            mx = max ( mx , cnt ) ;
            cnt = 0 ;
        }
    }
    for ( int i = 0 ; i < s.size() ; i++ )
    {
        if ( s[i] == '(' )
        {
            int t = i ;
            while ( true )
            {
                if ( ( s[t] != '(' and s[t] != '_' and s[t] != ')' ) )
                {
                    cnt++ ;
                }
                if ( s[t] == '_' or s[t] == ')' )
                {
                    if  ( cnt > 0 )
                    {
                        lnt++ ;
                        cnt = 0 ;
                    }
                    cnt = 0 ;
                }
                if ( s[t] == ')' )
                {
                    break ;
                }
                t++ ;
            }
        }
    }
    cout << endl ;
    if ( mx != -INF )
    {
        cout << mx << " " ;
    }
    else
    {
        cout << 0 << " " ;
    }
    cout << lnt ;
}

#include <iostream>
#include <cstdio>
#include <sstream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <vector>
using namespace std;

long long f1(string s1)
{
    int i, n, s2 = 0;
    for (i = 0; i < s1.length(); i++)
    {
        if (s1[i] == ' ')
             s2++;
    }
    if (s1.length() ==  0)
        return 0;
    else
        return s2 + 1;
}

long long f(string s)
{
    string s2;
    int i, maxc, j = 0;
    maxc = 0;
    for (i = 0; i < s.length(); i++)
    {
        if (s[i] == ' ')
        {
            if (i - j > maxc)
            {
                s2 = s.substr(j,i-j);
                maxc = i - j;
            }
        j =  i + 1;
        }
    }
    if (s.length() - j > maxc)
            {
                s2 = s.substr(j,i-j);
                maxc = i - j;
            }
    return maxc;
}

int main()
{
    //freopen("input1.txt.txt", "r", stdin);
    long long i, j, kol = 0, kol1 = 0, n;
    string s, s1 = "";
    cin >> n;
    getline(cin, s);
    getline(cin, s);
    //cout << s << endl;
    while (s.find('(') != std::string::npos)
    {
        s1 += s.substr(s.find('('), s.find(')') - s.find('(') + 1);
        s.erase(s.find('('), s.find(')') - s.find('(') + 1);
    }
    replace(s1.begin(), s1.end(), '_', ' ');
    replace(s1.begin(), s1.end(), '(', ' ');
    replace(s1.begin(), s1.end(), ')', ' ');
    replace(s.begin(), s.end(), '_', ' ');
    while (s.find("  ") != std::string::npos)
        s.erase(s.find("  "), 1);
    while (s1.find("  ") != std::string::npos)
        s1.erase(s1.find("  "), 1);
    //cout << s << endl << s1 << endl;
    if (s1[0] == ' ')
        s1.erase(0, 1);
    if (s1[s1.length() - 1] == ' ')
        s1.erase(s1.length() - 1, 1);
    //cout << s << endl;
    cout << f(s) << " " << f1(s1);
}

#include <bits/stdc++.h>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define all(c) c.begin(),c.end()

void INPUT() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int32_t main(){
    IOS INPUT();
    int n;
    cin>>n;
    string s;
    cin>>s;
    int out=0,word=0,cnt=0;
    stack <char> st;
    for (int i=0; i<n; i++) {
        if (s[i]=='(') st.push(s[i]);
        else if (s[i]==')') st.pop();
        if ((s[i]=='_' || s[i]==')' || (i==0)) && !st.size()) {
            for (int j=i+1; j<n; j++) {
                if ((s[j]>='A' && s[j]<='Z') || (s[j]>='a' && s[j]<='z')) cnt++;
                else {
                    out=max(out,cnt);
                    cnt=0;
                    break;
                }
            }
        }
    }
    out=max(out,cnt);
    while (st.size()) st.pop();
    cnt=0;
    for (int i=0; i<n; i++) {
        if (s[i]=='(') st.push(s[i]);
        if (st.size()) {
            if (((s[i]>='A' && s[i]<='Z') || (s[i]>='a' && s[i]<='z')) && !cnt) cnt++;
            else if (cnt && (s[i]=='(' || s[i]==')' || s[i]=='_')) {
                //cout<<cnt<<endl;
                word++,cnt=0;
            }
            if (s[i]==')') st.pop();
        }
    }
    cout<<out<<' '<<word<<endl;
    return 0;
}

/*
 * shoflk kalba.cpp
 *
 *  Created on: Sep 17, 2016
 *      Author: A7mD Sa3iiD
 *		time: 11:15:28 PM
 */

#include <bits/stdc++.h>
#include<bitset>
using namespace std;
#define bye return 0
#define oo 0x3f3f3f3f
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define F  first
#define S  second
#define EPS 1e-9
#define khod push_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<int, int> mpii;
typedef map<ll, ll> mpll;
int dx[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int dy[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
double PI = 3.1415926535897932384626433832795;
string vowel = "aeiouy";
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	/*#ifndef ONLINE_JUDGE
	 freopen("buy.in", "r", stdin);
	 freopen("output.txt", "w", stdout);
	 #endif*/
	int n ;
	string s ;
	cin>>n;
	cin.ignore();
	getline(cin,s);
	string tmp = s ;
	for(int i = 0; i < n ; i++){
		if(tmp[i]=='('){
			for(int j = i ; ;j++){
				if(tmp[j]==')'){tmp[j]='*';break;}
				tmp[j]='*';

			}
		}
		if(tmp[i]=='_')tmp[i]='*';
	}
	int cnt = 0 , c = 0;
	for(int i = 0 ; i < n ; i++){
		if(s[i]=='('){
			for(int j = i+1 ; ; j++){
				if(s[j]!='_'&&s[j]!=')')c++;
				else {
					if(c)cnt++;
					c=0;

				}
				if(s[j]==')'){i=j+1;break;}
			}
		}
	}
	int mx = 0 ;
	c = 0 ;
	for(int i = 0 ; i < n ; i++){
		if(tmp[i]=='*'){
			mx=max(mx,c);
			c=0;
		}
		else c++;

	}
	if(c)mx=max(mx,c);
	cout<<mx<<" "<<cnt;

	bye;
}

#define _CRT_SECURE_NO_WARNINGS
#include<bits\stdc++.h>
using namespace std;

#define PI 3.14159265359
#define all(v) v.begin(),v.end()
#define sortva(v) sort(all(v))
#define sortvd(v) sort(v.rbegin(),v.rend())
#define sortaa(a,n) sort(a,a+n)
#define sortad(a,n) sort(a,a+n),reverse(a,a+n)
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define sfstr(v) scanf("%s", v);
#define sz(v) v.size()
#define ndl puts("")
#define SS stringstream
typedef long long ll;
typedef unsigned long long ull;

int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };

void PLAY() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	cout << fixed << setprecision(9);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

int main() {
	PLAY();

	int n;
	string s;
	cin >> n >> s;

	vector<string> par, no;
	for (int i = 0; i < n; i++) {
		if (s[i] == '(') {
			string tmp = "";
			i++;
			while (i < n && s[i] != ')')
				tmp += s[i++];
			par.push_back(tmp);
		}
	}
	int idx = s.find("(");
	while (idx != -1) {
		int an = s.find(")");
		s.erase(idx, an - idx + 1);
		idx = s.find("(");
	}
	idx = s.find("_");
	while (idx != -1) {
		string tmp = "_";
		int i = idx + 1;
		for (; i < sz(s) && isalpha(s[i]); i++) {
			tmp += s[i];
			if (s[i] == '_') break;
		}
		if (i < sz(s) && s[i] == '_')
			tmp += '_';
		int ok = 1;
		if (tmp.back() != '_') ok = 0;
		if (ok && sz(tmp) > 2)
			no.push_back(tmp);
		s.erase(0, i);
		if (!sz(s)) break;
		idx = s.find("_");
	}
	vector<string> tmp = par;
	par.clear();
	for (int x = 0; x < sz(tmp); x++) {
		string s = "_" + tmp[x] + "_";
		idx = s.find("_");
		while (idx != -1) {
			string tmp = "_";
			int i = idx + 1;
			for (; i < sz(s) && isalpha(s[i]); i++) {
				tmp += s[i];
				if (s[i] == '_') break;
			}
			int ok = 1;
			if (i < sz(s) && s[i] == '_')
				tmp += '_';
			if (tmp.back() != '_') ok = 0;
			if (ok && sz(tmp) > 2)
				par.push_back(tmp);
			s.erase(0, i);
			if (!sz(s)) break;
			idx = s.find("_");
		}
	}
	int mx = 0;
	for (int i = 0; i < sz(no); i++)
		mx = max(mx, (int)sz(no[i]) - 2);
	cout << mx << " " << sz(par) << endl;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
void solve() {
    int n;
    cin >> n;
    string str;
    cin >> str;
    int count = 1;
    int max = 0;
    vector <int> v;
    for(int i=0;i<n;i++) {
        if(str[i] == '(') {
            while(str[i] != ')')
                i++;
        }
        if(str[i] != '_')
            v.push_back(i);
    }
    for(int i=0;i<v.size()-1;i++) {
        if(v[i+1] == v[i]+1)
            count++;
        else {
            if(count > max)
                max = count;
            count = 1;
        }
    }
    cout << max << " ";

    count = 0;
    // no of words inside parenthesis
    for(int i=0;i<n;i++) {
        if(str[i] == '(') {
            while(str[i] != ')') {
                i++;
                if(str[i] == '_')
                    continue;
                if(str[i] != '_' && str[i] != ')') {
                    while(str[i] != '_' && str[i] != ')') {
                        i++;
                    }
                    count++;
                }
            }
        }
    }
    cout << count << endl;
    return ;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
    return 0;
}

#include <bits/stdc++.h>

int main()
{
    int n;
    std::cin>>n;
    std::string v;
    std::cin>>v;
    int max_length=0;
    int length=0;
    bool run=true;
    for (int i=0;i<n;i++){
        if (v.at(i)=='(')
            run=false;
        if (v.at(i)==')'){
            run=true;
            continue;
        }
        if (!run)
            continue;
        if (v.at(i)=='_')
            length=0;
        else{
            length++;
            max_length=std::max(length,max_length);
        }
    }
    std::cout<<max_length<< " ";
    while (v.find("__")!=std::string::npos){
        v.erase(v.begin()+v.find("__"));
    }

    while (v.find("(_)")!=std::string::npos){
        v.erase(v.begin()+v.find("(_)"),v.begin()+v.find("(_)")+3);
    }

    bool work=false;
    int result=0;
    int counter=0;

    for (int i=0;i<v.size();i++){
        if (v.at(i)=='('){
            work=true;
            counter=0;
        }
        else if (v.at(i)==')'){
            work=false;
            result+=counter+1;
        }
        if (work){
            if (v.at(i)=='_'&&v.at(i-1)!='('&&(v.at(i+1)!=')'))
                counter++;
        }
    }
    std::cout<<result;
}

#include<iostream>
#include<string>
using namespace std;
int main(){
    bool pp=true;
    int i,j=0,k,m=0,n,a,b,l,maxi=0;
    cin >> n;
    int c[n]={0},kuo[n];
    string s;
    cin >> s;
    for(i=0;i<n;i++){
        kuo[i] = -1;
    }
    for(i=0;i<n;i++){
        if(s[i]!='_'&&s[i]!='('&&s[i]!=')'){
            c[j]++;
        }
        else if(c[j]!=0){
            j++;
        }
        if(c[j]==1){
            for(k=i;k>=0;k--){
                if(s[k]==')'){
                    break;
                }
                if(s[k]=='('){
                    kuo[m] = j;
                    m++;
                    break;
                }
            }
        }
    }
    for(i=0;i<j;i++){
        for(l=0;l<m;l++){
            if(i==kuo[l]){
                pp = false;
                break;
            }
        }
        if(pp==false){
            pp = true;
            continue;
        }
        if(c[i]>maxi){
            maxi = c[i];
        }
    }
    cout <<maxi<< " " <<m;

}

#include <iostream>
#include <cmath>
#include <set>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;
const int maxn = 1000001;
int a[maxn];

const int mod = 1e9 + 7;

char L[200], R[200];
map<int, int> m;

long long gcd(long long a, long long b) {
    if(a == 0) return 0;
    else {
        long long k = b/ a;
        return k + gcd(b % a, a);
    }
}

string getnum(string code) {
    int res = 0;
    int d = 1;
    for(int i = (int)code.length() - 1; i>= 0; i--) {
        res += d * (code[i] - 'A' + 1);
        d *= 26;
    }
    return to_string(res);
}

string d[maxn];
string getcode(int n) {
    return d[n];
}

void precalc() {
    d[1] = "A";
    for(int i = 2; i < maxn; i++) {
        string s = d[i - 1];
        int c = 1;
        for(int j = 0; j < s.length(); j++) {
            int curc = s[j] -'A';
            int newc = curc + c;
            if(newc == 26) {
                newc = 0;
                c = 1;
                s[j] = 'A';
            }
            else {
                s[j] = 'A' + newc;
                c = 0;
                break;
            }

        }
        if(c == 1) s += 'A';
        d[i] = s;
    }
    for(int i = 1; i < maxn; i++) {
        reverse(d[i].begin(), d[i].end());
    }
}

string ones[] ={
    "zero", "one", "two", "three", "four",
    "five", "six", "seven","eight","nine", "ten", "eleven", "twelve", "thirteen", "fourteen",
    "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"
};

string tens[] {
    "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"
};

int main() {
   int n;
   cin >> n;
   string s;
   cin >> s;
   n = s.length();
   bool in = s[0] == '(';
   int Max = 0;
   int cur = (bool)isalpha(s[0]);
   int cnt = 0;
   for(int i =  1;  i < n; i++) {
        if(isalpha(s[i - 1]) and !isalpha(s[i])) {
            if(in) {
                cnt++;
            }
        }
        if(isalpha(s[i]) and !in) {
            cur++;
            Max = max(cur, Max);
        }
        if(!isalpha(s[i]))cur = 0;
        if(s[i] == '(') in = 1;
        if(s[i] == ')') in = 0;
   }
   cout << Max << ' ' << cnt << endl;

}

#include <iostream>
#include <cstdio>
#include <ctype.h>

using namespace std;
const int maxn = 300;
const int INF = 1e6;

char str[maxn];
int n;

int main()
{
    //freopen("in.txt", "r", stdin);
    while(~scanf("%d", &n)) {
        scanf("%s", str);

        int inside_ = 0, len = 0;

        bool inPar = false;
        bool isWord = false;
        int tmp = 0;
        for(int i = 0; i < n; i++) {
            if(isalpha(str[i])) {
                if(!isWord) isWord = true;
                if(!inPar)  tmp++;
            }
            if(!isalpha(str[i])) {
                if(isWord && !inPar) {
                    isWord = false;
                    len = max(len, tmp);
                    tmp = 0;
                }
                if(isWord && inPar) {
                    isWord = false;
                    inside_++;
                }
                if(str[i] == '(') {
                    inPar = true;
                }
                if(str[i] == ')') {
                    inPar = false;
                }

            }
        }
        printf("%d %d\n", len, inside_);
    }
    return 0;
}

#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#include<queue>
#include<algorithm>
using namespace std;
char a[260];
int main()
{
    int  n;
    while(cin>>n)
    {

    int k=0,m=0;
    for(int i=0;i<n;i++)
    {
        int num=0,mum=0;
        cin>>a[i];

    }
    int f=0;
    int num=0,mum=0;
    int flag=0;
    int s=0;
    int st1=-1,st2=-1,ed1=-1,ed2=-1;
    int q,z;
    for(int i=0;i<n;i++)
    {
        if(a[i]=='('||a[i]=='_')
        {
            st1=i;
            break;
        }
    }
    for(int i=n-1;i>=0;i--)
    {
       if(a[i]==')'||a[i]=='_')
        {
            ed1=i;
            break;
        }
    }
    if(st1>=0&&ed1>=0&&q<z)
    {
        q=st1;
        z=ed1;
    }
    else
    {
        cout<<"0 0"<<endl;
        return 0;
    }
   // cout<<q<<" "<<z<<endl;
    for(int i=q;i<=z;i++)
    {
        if(a[i]=='(')
        {
            f++;
            flag=0;
            num=0;
            continue;
        }
        if(a[i]==')')
        {
            f--;
            continue;
        }
        if(!f)
        {
           // cout<<a[i]<<endl;
            if(((a[i]-'a')>=0&&a[i]-'a'<=('z'-'a'))||(a[i]-'A'>=0&&a[i]-'A'<=('Z'-'A')))
            {
               // cout<<a[i]<<endl;

                num++;
                if(num>k)
                {
                    k=num;
                }
            }
            else
            {
                if(num>k)
                {
                    k=num;
                }
                num=0;
            }
        }
        else
        {
            // cout<<a[i]<<endl;
             if(((a[i]-'a')>=0&&a[i]-'a'<=('z'-'a'))||(a[i]-'A'>=0&&a[i]-'A'<=('Z'-'A')))
            {
               // cout<<a[i]<<endl;
                if(!flag)
                {
                    //cout<<a[i]<<endl;
                    mum++;
                    flag=1;
                }

            }
            else
            {
                if(flag)
                {
                    flag=0;
                }
            }
        }
    }
    m=mum;

        cout<<k<<" "<<m<<endl;

    }
}

 #include <bits/stdc++.h>

 #define ll long long
 #define mod (1e+9)+7
 #define F first
 #define S second
 #define ii pair<ll , ll>
 #define vii vector<ii >
 #define vi vector <int>
 #define pb push_back
 #define mp make_pair
 #define trav(s , it) for(auto& it : s)
 #define all(x) x.begin(),x.end()
 #define here cout << "here"
 #define FixTo(x , y) cout.precision(y),cout << fixed << x
 #define retToDef cout << defaultfloat
 #define Montazer ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

 using namespace std;

 ll dig2 (ll n){
  return log2(n)+1;
 }

 int main () {
  Montazer
  int n;
  cin >> n;
  string s;
  cin >> s;
  bool outside=true;
  int cnt=0  , ans=0 , ans2=0;
  for (int i=0 ; i<s.size() ; i++){
   if (s[i]=='(')outside = false;
   else if (s[i]==')') outside = true;
   if (s[i]=='_'){ans=max(ans , cnt); cnt=0;}
   if (s[i]!='_'&&outside){cnt++;}
   if (!outside){
    if (s[i]!='_' && s[i+1]=='_'&&s[i]!='(')ans2++;
    if (s[i]!='_'&&s[i]!='('&&s[i+1]==')') ans2++;
   }
  }
  cout << ans << " " << ans2;
  return 0;
 }

/*************************************************************************
    > File Name: test.cpp
    > Author: Akira
    > Mail: qaq.febr2.qaq@gmail.com
 ************************************************************************/

#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <ctime>
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
#define MST(a,b) memset(a,b,sizeof(a))
#define CLR(a) MST(a,0)
#define Sqr(a) ((a)*(a))
using namespace std;

#define MaxN 100000
#define MaxM MaxN*10
#define INF 0x3f3f3f3f
#define bug cout<<88888888<<endl;
#define MIN(x,y) (x<y?x:y)
#define MAX(x,y) (x>y?x:y)

int n;
string str;
int main()
{
    while(~scanf("%d", &n))
    {
        cin >> str;
        int cnt = 0;
        int Max = 0;
        int i=0;
        while(i<n)
        {
            if(i==n) break;
            //cout << str[i] <<" " <<Max << "_" << cnt << endl;
            if(str[i] == '_' || str[i] == ')')
            {
                i++;
                int flag = 0;
                while(i<n)
                {
                    if(str[i] == '_')
                    {
                        if(flag) Max = MAX(Max, flag);
                        flag = 0;
                    }
                    else if(str[i] == '(')
                    {
                        if(flag) Max = MAX(Max, flag);
                        break;
                    }
                    else flag++;
                    i++;
                }
                if(i==n) break;
            }
            else if(str[i] == '(')
            {
                i++;
                int flag = 0;
                while(i<n)
                {
                    if(str[i] == '_')
                    {
                        if(flag) cnt++;
                        flag = 0;
                    }
                    else if(str[i] == ')')
                    {
                        if(flag) cnt++;
                        break;
                    }
                    else flag++;
                    i++;
                }
                if(i==n) break;
            }
            else i++;
        }
        cout << Max << " " << cnt << endl;
    }
    //system("pause");
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long int result=0,word=0,i,temp=0,t=0,large=0,n,result1=0;
 cin>>n;
    string str;
    cin>>str;
    for(i=0;i<str.length();i++)
    {
        if(str[i]=='(')
        {
            if((str[i+1]>='a'&&str[i+1]<='z')||(str[i+1]>='A'&&str[i+1]<='Z'))
              word++;
            result++;
        }
        if(result>=1)
        {
            if(str[i]=='_'&&((str[i+1]>='a'&&str[i+1]<='z')||(str[i+1]>='A'&&str[i+1]<='Z')))
                word++;
        }

        if(str[i]==')')
        {
            result=0;
        }
    }

  for(i=0;i<str.length();i++)
  {

if(result1==0)
{
            if((str[i]>='a'&&str[i]<='z')||(str[i]>='A'&&str[i]<='Z'))
            {

                large++;

            }

                if(str[i]=='_'||str[i-1]==')'||str[i]=='(')
            {

                t++;

                if(t==1)
                temp=large;
                if(t>1)
                {
                    if(temp>=large)
                    {
                        temp=temp;

                    }
                    else
                    {
                        temp=large;
                    }
                }
              large=0;

            if(str[i]=='(')
            {
                result1=5;
            }

            }

            }

             if(str[i]==')')
            {
                result1=0;
            }

  }

if(temp>=large)
                    {
                        temp=temp;

                    }
                    else
                    {
                        temp=large;
                    }
    cout<<temp<<" "<<word<<endl;

    return 0;
}

#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<limits.h>
#include<map>
#include<stack>
#include<stdio.h>
#include<queue>
#include<cmath>
#include<string.h>

using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define LL long long int
#define pb push_back
#define mp make_pair
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define VSP vector<set<PLL > >
#define PIS pair< int,string>
struct compare_length {
    bool operator()(const std::string &l, const std::string &r) const {
        return l.size()<r.size();
    }
};

int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
  //  fast

   /*freopen("in.txt","r",stdin);
   freopen("out.txt","w",stdout);*/
    LL max=0,p,sum,s1=0,y,a1,x,k,r=0,t=0,j=0,w=0,f=0,l;
    LL n,i=0,d=0;
    cin>>n;
    char c;
    for(x=0;x<n;x++)
    {
    	cin>>c;

    	if(c=='(')
    	{
    		f=0;
    		d=0;
    		do
    		{

    			if(c!='_' && f==0 && c!='(')
    		    {
    			  i++;
    			  f=1;
    			  //cout<<i<<c<<"\n";
    			 // cout<<c<<"\n";

    		    }
    		    else
    		    	if(c=='_')
    		    	f=0;
               cin>>c;
               //cout<<c<<"\n";
    		}while(c!=')');
    	}
    	else
    		if(c!='_')
    		{
    			d++;
    		}
    		else
    		{
    			if(d>max)
    				max=d;
    			d=0;
    			//cout<<max<<"\n";
    		}
    }
    cout<<max<<" "<<i;
   return 0;

}