Modern text editors usually show some information regarding the document being edited. For example, the number of words, the number of pages, or the number of characters.In this problem you should implement the similar functionality.You are given a string which only consists of:  uppercase and lowercase English letters,  underscore symbols (they are used as separators),  parentheses (both opening and closing). It is guaranteed that each opening parenthesis has a succeeding closing parenthesis. Similarly, each closing parentheses has a preceding opening parentheses matching it. For each pair of matching parentheses there are no other parenthesis between them. In other words, each parenthesis in the string belongs to a matching "opening-closing" pair, and such pairs can't be nested.For example, the following string is valid: "_Hello_Vasya(and_Petya)__bye_(and_OK)".Word is a maximal sequence of consecutive letters, i.e. such sequence that the first character to the left and the first character to the right of it is an underscore, a parenthesis, or it just does not exist. For example, the string above consists of seven words: "Hello", "Vasya", "and", "Petya", "bye", "and" and "OK". Write a program that finds:  the length of the longest word outside the parentheses (print 0, if there is no word outside the parentheses),  the number of words inside the parentheses (print 0, if there is no word inside the parentheses).

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

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

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

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.SortedSet;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.util.Vector;

/**
 * Created by rakshit on 7/1/17.
 * Java is Love and Code is Beautiful..
 */
public class TextDocument {

    static class InputReader
    {
        public BufferedReader reader;
        public StringTokenizer tok;

        public InputReader(InputStream inputStream)
        {
            reader =new BufferedReader(new InputStreamReader(inputStream));
            tok=null;
        }

        public InputReader(String inputFile) throws FileNotFoundException
        {
            reader=new BufferedReader(new FileReader(inputFile));
            tok=null;
        }

        public String nextLine()
        {
            String c="";
            try
            {
                c+=reader.readLine();
            }
            catch(IOException e)
            {
                throw new RuntimeException(e);
            }

            return c;
        }

        public String next()
        {
            while(tok==null || !tok.hasMoreTokens())
            {
                try
                {
                    tok=new StringTokenizer(nextLine());
                }
                catch(Exception e)
                {
                    throw new RuntimeException(e);
                }
            }

            return tok.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

        public long nextLong()
        {
            return Long.parseLong(next());
        }

        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
    }

    public static void main(String args[])
    {
        InputStream inputstream=System.in;
        OutputStream outputstream=System.out;
        InputReader in=new InputReader(inputstream);
        PrintWriter out=new PrintWriter (outputstream);
        Task solver=new Task();
        solver.solve(in,out);
    }

    static class Task
    {
        private final int k=Integer.MAX_VALUE;
        public void solve(InputReader in , PrintWriter out)
        {
            int n=in.nextInt();
            String s=in.next();

            boolean flag=false;
            SortedSet<Integer>store=new TreeSet<>();
            int box=0;
            store.add(0);
            int l=0;
            int a=k,b=k;

            Vector<Pair>ret=new Vector<>();

            for(int i=0 ;i<n ;i++)
            {
                if(flag==false)
                {
                    if(s.charAt(i)!='_' && s.charAt(i)!='(')
                    {
                        l++;
                      //  out.print(s.charAt(i));
                    }
                    else
                    {
                    //    out.println();
                        store.add(l);
                        l=0;
                    }

                    if(s.charAt(i)=='(')
                    {
                        flag=true;
                        store.add(l);
                        l=0;
                        a=i;
                    }
                }

                if(s.charAt(i)==')')
                {
                    flag=false;
                    b=i;
                }

                if(a!=k && b!=k)
                {
                    Pair pair=new Pair(a,b);
                    ret.add(pair);
             //       out.println(pair.first()+" "+pair.second());
                    a=k;
                    b=k;
                }
            }

            store.add(l);

            l=0;

            for(int i=0 ;i<ret.size() ;i++)
            {
                for(int j=ret.elementAt(i).first()+1 ;j<ret.elementAt(i).second() ;j++)
                {
                    if(s.charAt(j)!='_')
                    {
                        l++;
               //         out.print(s.charAt(j));
                    }
                    else
                    {
              //          out.println();
                        if(l>0) {
                            box++;
                            l = 0;
                        }
                    }
                }

                if(l>0) {
                    box++;
                    l = 0;
                }
            }
            out.println(store.last() +" "+box);
            out.flush();
        }
    }

    static class Pair
    {
        int a,b;
        Pair(int a,int b)
        {
            this.a=a;
            this.b=b;
        }

        public int first()
        {
            return a;
        }

        public int second()
        {
            return b;
        }
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class timeFormat {
	public static void main(String[] argv) {
		int n, longest = 0, parStrings = 0, count = 0;
		String string;
		char[] chars;
		boolean inPar = false, newString = true;
		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		scanner.nextLine();
		string = scanner.nextLine();
		chars = string.toCharArray();
		for(int i = 0; i < n; i++) {
			if(chars[i] == '(') {
				inPar = true;
				newString = true;
				continue;
			}
			else if(chars[i] == ')') {
				inPar = false;
				newString = true;
				continue;
			}
			else
				if(chars[i] == '_') {
					newString = true;
					continue;
				}
			count = 0;
			while(i < n && chars[i] != '_' && chars[i] != ')' && chars[i] != '(') {

				if(inPar && newString) {
					parStrings++;
					newString = false;
				}
				else
					if(!inPar)
						count++;
				i++;
			}
			i--;
			if(count > longest)
				longest = count;
		}
		System.out.format("%d %d", longest, parStrings);
		scanner.close();
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class main{
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader entrada = new BufferedReader(new InputStreamReader(System.in));
		int cantidad = Integer.parseInt(entrada.readLine());
		int max = 0, palabras = 0, num1 = 0, num2 = 0;
		boolean dentro = false;
		String frase = entrada.readLine();
		char[] c = new char[cantidad];
		c = frase.toCharArray();
		for(int i=0;i<cantidad;i++){
			if(c[i]=='('){
				dentro = true;
				num1 = 0;
			}else if(c[i]==')'){
				dentro = false;
				if(num2>0){
					palabras++;
					num2 = 0;
				}
			}else{
				if(dentro){
					if(c[i]!='_'){
						num2++;
					}else{
						if(num2>0){
							palabras++;
							num2 = 0;
						}
					}
				}else{
					if(c[i]!='_'){
						num1++;
					}else{
						num1 = 0;
					}
				}
			}
			if(num1>=max){
				max = num1;
			}
		}
		System.out.println(max);
		System.out.println(palabras);
	}
}

/*
 * Remember a 6.0 student can know more than a 10.0 student.
 * Grades don't determine intelligence, they test obedience.
 * I Never Give Up.
 * I will become Candidate Master.
 * I will defeat Saurabh Anand.
 * Skills are Cheap,Passion is Priceless.
 */
import java.util.*;
import java.util.Map.Entry;
import java.io.*;

import static java.lang.System.out;
import static java.util.Arrays.*;
import static java.lang.Math.*;
public class ContestMain {
	private static Reader in=new Reader();
	private static StringBuilder ans=new StringBuilder();
	private static long MOD=1000000000+7;//10^9+7
	private static final int N=100000+7; //10^5+7
//	private static final double EPS=1e-9;
//	private static final int LIM=26;
//	private static final double PI=3.1415;
	private static ArrayList<Integer> v[]=new ArrayList[N];
//	private static int color[]=new int[N];
	private static boolean mark[]=new boolean[200000+7];
//	private static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//	private static ArrayList<Pair> v[]=new ArrayList[N];
	private static long powmod(long x,long n){
		if(n==0||x==0)return 1;
		else if(n%2==0)return(powmod((x*x)%MOD,n/2));
		else return (x*(powmod((x*x)%MOD,(n-1)/2)))%MOD;
	}
	private static void shuffle(long [] arr) {
		for (int i = arr.length - 1; i >= 2; i--) {
			int x = new Random().nextInt(i - 1);
	        long temp = arr[x];
	        arr[x] = arr[i];
	        arr[i] = temp;
	    }
	 }
//	private static long gcd(long a, long b){
//		if(b==0)return a;
//		return gcd(b,a%b);
//	}
//	private static boolean check(int x,int y){
//		if((x>=0&&x<n)&&(y>=0&&y<m)&&mat[x][y]!='X'&&!visited[x][y])return true;
//		return false;
//	}
//	static class Node{
//		int left;
//		int right;
//		Node(){
//			left=0;
//			right=0;
//		}
//	}
	public static void main(String[] args) throws IOException{
		int n=in.nextInt();
		String s=in.next();
		int cout=0,cin=0,cnt=0;
		boolean flag=true;
		for(int i=0;i<n;i++){
			if(s.charAt(i)=='_'){
				if(flag){
//					out.print(i+" ");
					cout=max(cout,cnt);
					cnt=0;
				}
			}
			else if(s.charAt(i)=='('){
				flag=false;
				cout=max(cout,cnt);
				cnt=0;
			}
			else if(s.charAt(i)==')')flag=true;
			else if(flag){
//				out.print(i+" ");
				cnt++;
			}
		}
		cout=max(cnt,cout);
		cnt=0;
		flag=false;
		int word_found=0;
		for(int i=0;i<n;i++){
			if(s.charAt(i)=='(')flag=true;
			else if(s.charAt(i)=='_'){
				if(flag&&word_found==1){
					cin++;
					word_found=0;
				}
			}
			else if(s.charAt(i)==')'){
				if(word_found==1)cin++;
				word_found=0;
				flag=false;
			}
			else if(flag)word_found=1;
		}
		out.println(cout+" "+cin);
	}
	static class Pair<T> implements Comparable<Pair>{
		int l;
		int r;
		Pair(){
			l=0;
			r=0;
		}
		Pair(int k,int v){
			l=k;
			r=v;
		}
//		@Override
//		public int compareTo(Pair o) {
//			if(o.l!=l)return (int) (l-o.l);
//			else return (int)(r-o.r);
//		}
		//Fenwick tree question comparator
		@Override
		public int compareTo(Pair o) {
			if(o.r!=r)return (int) (r-o.r);
			else return (int)(l-o.l);
		}
	}
	static class Reader{
        BufferedReader br;
        StringTokenizer st;
        public Reader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {

                	st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}

import java.io.*;
import java.util.*;
import java.math.*;
public class forces{
/*
  public static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    static class Reader
      {
          final private int BUFFER_SIZE = 1 << 16;
          private DataInputStream din;
          private byte[] buffer;
          private int bufferPointer, bytesRead;

          public Reader()
          {
              din = new DataInputStream(System.in);
              buffer = new byte[BUFFER_SIZE];
              bufferPointer = bytesRead = 0;
          }

          public Reader(String file_name) throws IOException
          {
              din = new DataInputStream(new FileInputStream(file_name));
              buffer = new byte[BUFFER_SIZE];
              bufferPointer = bytesRead = 0;
          }

          public String readLine() throws IOException
          {
              byte[] buf = new byte[64]; // line length
              int cnt = 0, c;
              while ((c = read()) != -1)
              {
                  if (c == '\n')
                      break;
                  buf[cnt++] = (byte) c;
              }
              return new String(buf, 0, cnt);
          }

          public int nextInt() throws IOException
          {
              int ret = 0;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();
              do
              {
                  ret = ret * 10 + c - '0';
              }  while ((c = read()) >= '0' && c <= '9');

              if (neg)
                  return -ret;
              return ret;
          }

          public long nextLong() throws IOException
          {
              long ret = 0;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();
              do {
                  ret = ret * 10 + c - '0';
              }
              while ((c = read()) >= '0' && c <= '9');
              if (neg)
                  return -ret;
              return ret;
          }

          public double nextDouble() throws IOException
          {
              double ret = 0, div = 1;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();

              do {
                  ret = ret * 10 + c - '0';
              }
              while ((c = read()) >= '0' && c <= '9');

              if (c == '.')
              {
                  while ((c = read()) >= '0' && c <= '9')
                  {
                      ret += (c - '0') / (div *= 10);
                  }
              }

              if (neg)
                  return -ret;
              return ret;
          }

          private void fillBuffer() throws IOException
          {
              bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
              if (bytesRead == -1)
                  buffer[0] = -1;
          }

          private byte read() throws IOException
          {
              if (bufferPointer == bytesRead)
                  fillBuffer();
              return buffer[bufferPointer++];
          }

          public void close() throws IOException
          {
              if (din == null)
                  return;
              din.close();
          }
      }
      static long power(long k){
        long t=k&1,count=0;
        while(k!=0){
          if(t==0)
            count++;
          k=k>>1;
          t=k&1;
        }
        return count;
      }*/
  static long largest_power(long N)
  {
      //changing all right side bits to 1.
      N = N| (N>>1);
      N = N| (N>>2);
      N = N| (N>>4);
      N = N| (N>>8);
      N = N| (N>>16);
      N = N| (N>>32);
      return (N+1)>>1;

  }
  public static void main (String args[]) throws IOException{
      //Reader in = new Reader();
      BufferedOutputStream out=new BufferedOutputStream(System.out);

      //BufferedReader in =new BufferedReader(new InputStreamReader(System.in));
      StringBuilder sb = new StringBuilder();
      Scanner in=new Scanner(System.in);
      int i,n=in.nextInt(),k=0,count=0;
      String z=in.next();
      int []ans=new int[2];
      for(i=0;i<n;i++){
        if(z.charAt(i)=='_'){
          if(count>ans[k]&&k==0)
            ans[k]=count;
          else if(k==1){
            if(count>0)
              ans[k]++;
          }
          count=0;
        }
        else if(z.charAt(i)=='('){
          k=1;
          if(count>ans[0])
            ans[0]=count;
          count=0;
        }
        else if(z.charAt(i)==')'){
          k=0;
          if(count>0)
            ans[1]++;
          count=0;
        }
        else{
          count++;
        }
      }
      if(count>ans[0]&&k==0)
        ans[0]=count;
      sb.append(ans[0]+" "+ans[1]+"\n");
      //sb=sb.append(count);
      out.write(sb.toString().getBytes());

      out.flush();
      in.close();
    }
}
class Reader {
 final private int BUFFER_SIZE = 1<<16;
 private DataInputStream din;
 private byte[] buffer;
 private int bufferPointer, bytesRead;

 public Reader() {
   din = new DataInputStream(System.in);
   bytesRead = bufferPointer = 0;
   buffer = new byte[BUFFER_SIZE];
 }

 public Reader(String filename) throws IOException {
   din = new DataInputStream(new FileInputStream(filename));
   bytesRead = bufferPointer = 0;
   buffer = new byte[BUFFER_SIZE];
 }

 private byte read() throws IOException{
   if (bufferPointer == bytesRead) {
     fillBuffer();
   }
   return buffer[bufferPointer++];
 }

 private void fillBuffer() throws IOException{
   bytesRead = din.read(buffer, bufferPointer = 0 , BUFFER_SIZE);
   if (bytesRead == -1) {
     buffer[0] = -1;
   }
 }

 public void close() throws IOException {
   if (din != null) {
     din.close();
   }
 }

 public String nextLine() throws IOException {
   byte[] buf = new byte[64];
   int cnt = 0;
   byte c;
   while (isWhiteSpace(c = read())) {}
   while (c != -1) {
     if (c == '\n') {
       break;
     }
     buf[cnt++] = c;
     c = read();
   }
   return new String(buf, 0 , cnt);
 }
 public int nextLine(int size) throws IOException {
   int cnt = 0;
   byte c;
   while (isWhiteSpace(c = read())) {}
   for (int i = 0 ; i < size ; i++) {
     if (c == '0') {
         cnt++;
     }
     c = read();
   }
   return cnt;
 }

 public String next() throws IOException {
   byte[] buf = new byte[64];
   int cnt = 0;
   byte c;
   while (isWhiteSpace(c = read())) {}
   while (c != -1) {
     if (isWhiteSpace(c)) {
       break;
     }
     buf[cnt++] = c;
     c = read();
   }
   return new String(buf, 0 , cnt);
 }

 public String next(int size) throws IOException {
   byte[] buf = new byte[size];
   int cnt = 0;
   byte c;
   while (isWhiteSpace(c = read())) {}
   while (c != -1) {
     if (isWhiteSpace(c)) {
       break;
     }
     buf[cnt++] = c;
     c = read();
   }
   return new String(buf, 0 , cnt);
 }

 public boolean isWhiteSpace(byte n) {
   return (n == ' ' || n == '\n' || n == '\r' || n == '\t');
 }

 public char nextChar() throws IOException {
   byte c = read();
   while (isWhiteSpace(c))
     c = read();
   return (char)c;
 }

 public int nextInt() throws IOException {
   int ret = 0;
   byte c = read();
   while (isWhiteSpace(c))
     c = read();
   boolean neg = (c == '-');
   if (neg)
     c = read();
   if (!(c >= '0' && c <= '9'))
     throw new InputMismatchException();
   do {
     ret = ret * 10 + c - '0';
   } while ((c = read()) >= '0' && c <='9');
   if (neg)
     return -ret;
   return ret;
 }

 public long nextLong() throws IOException {
   long ret = 0;
   byte c = read();
   while (isWhiteSpace(c))
     c = read();
   boolean neg = (c == '-');
   if (neg)
     c = read();
   if (!(c >= '0' && c <= '9'))
     throw new InputMismatchException();
   do {
     ret = ret * 10 + c - '0';
   } while ((c = read()) >= '0' && c <='9');
   if (neg)
     return -ret;
   return ret;
 }

 public double nextDouble() throws IOException {
   double ret = 0 , div = 1;
   byte c = read();
   while (isWhiteSpace(c))
     c = read();
   boolean neg = (c == '-');
   if (neg)
     c = read();
   do {
     ret = ret * 10 + c - '0';
   } while ((c = read()) >= '0' && c <= '9');

   if (c == '.') {
     while ((c = read()) >= '0' && c <= '9') {
       ret += (c - '0') / (div *= 10);
     }
   }

   if (neg)
     return -ret;
   return ret;
 }
}

import java.util.Scanner;

public class Words {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String str=sc.next();
		char[] ch=str.toCharArray();
		int[] temp=new int[n];
		int count=0;
		int k=0;
		for(int i=0;i<n;i++){
			temp[i]=0;
		}
		int flag = 0;
		if(ch[0]=='_'){
			flag=0;
		}
		else if(ch[0]=='('){
			flag=1;
		}
		for(int i=0;i<n;i++){
			if(flag==0){
				if(ch[i]=='_' ){
					k++;
				}
				else {
					if(ch[i]!='('){
						temp[k]++;
					}
					else if(ch[i]=='('){
						flag=1;

					}
					else if(ch[i]==')'){
						flag=0;
					}
				}
			}
			else{
				if(ch[i]==')'){
					flag=0;
					k++;
				}
				else if(i>0){
					 if(ch[i-1]=='('||ch[i-1]=='_'){
						 if( ch[i]!='_' && ch[i]!='('){
							 count++;
					 }

					}

				}

			}

		}

		int temp1;

		for(int i=0;i<n;i++){
			for(int j=i;j>0;j--){
				if(temp[j]>temp[j-1]){
					temp1=temp[j];
					temp[j]=temp[j-1];
					temp[j-1]=temp1;
				}
			}
		}
		System.out.println(temp[0]);
		System.out.println(count);
	}
}

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Prepare {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		in.next();
		String s = in.next();
		StringBuilder sb = new StringBuilder(s);
		String temp;
		int start, end;

		ArrayList<String> inside = new ArrayList<>();
		ArrayList<String> outside = new ArrayList<>();

		while (s.contains(")")) {
			start = s.indexOf('(');
			end = s.indexOf(')');
			temp = s.substring(start + 1, end);
			sb.replace(start, end + 1, "_");
			s = sb.toString();
			Collections.addAll(inside, temp.split("_"));
		}

		Collections.addAll(outside, s.split("_"));
		while (inside.contains(""))
			inside.remove("");

		int max = 0;
		for(String str : outside)
			if(max < str.length())
				max = str.length();

		System.out.print(String.format("%d %d", max, inside.size()));

		in.close();
	}

	static void print(Object a) {
		System.out.println(a);
	}
}

import java.util.*;
import java.math.*;
import java.io.*;

public class rnd375_B {
 static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
                return "";
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
static class P implements Comparable{

        private int x, y;

        public P(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public int hashCode() {
            return (x * 31) ^ y;
        }

        public boolean equals(Object o) {
            if (o instanceof P) {
                P other = (P) o;
                return (x == other.x && y == other.y);
            }
            return false;
        }
        public int compareTo(Object obj) {
		P l = (P) obj;
		if (this.x == l.x){
			if (this.y == l.y) return 0;
			return (this.y < l.y)? -1: 1;
		}
		return (this.x < l.x)? -1: 1;
	}
    }

public static void main(String[] args){

    FastScanner s = new FastScanner(System.in);
    StringBuilder op=new StringBuilder();
    int n=s.nextInt();
    String ip=s.next();
    int mwl=0;
    int wc=0;
    for (int i=0;i<ip.length();){
        if(ip.charAt(i)=='('){
            i++;
            int l=0;
            while(i<ip.length()){
                if(ip.charAt(i)==')'){
                    if(ip.charAt(i-1)!='('&& ip.charAt(i-1)!='_')wc++;
                    i++;
                    break;
                }
                else if(ip.charAt(i)=='_'){

                    if(ip.charAt(i-1)!='('&&ip.charAt(i-1)!='_')
                    wc++;
                }
                else
                    l++;

                i++;
            }
        }
        else if(ip.charAt(i)=='_')i++;
        else {
            int cl=1;
            //System.out.println(i+"-");
            i++;
             mwl=Math.max(mwl,cl);
            while(i<ip.length()){
                if(ip.charAt(i)=='_'||ip.charAt(i)=='(')
                {
                    mwl=Math.max(mwl,cl);

                    break;
                }
                else {
                    i++;
                    cl++;
                    mwl=Math.max(mwl,cl);
                }
            }
        }
       // System.out.println(mwl+" "+wc+" "+i);

    }
    System.out.println(mwl + " "+wc);

}

}

import java.util.Scanner;

public class Main10 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int am = scanner.nextInt();
        String zad = scanner.next();
        String s = zad;
        String skobki = "_";
        int str = -1;
        int len = s.length();

        for (int i = 0; i < len; i++) {
            char c = s.charAt(i);
            if (s.charAt(i) == '(') str = i;
            if (s.charAt(i) == ')') {
                skobki = skobki +"" + s.subSequence(str+1, i) + "_";
                s =  "" + s.subSequence(0, str) +"_"+ s.subSequence(i+1, s.length());
                len = s.length();
                i = str-1;
                str = -1;
            }
        }
        String arr [] = skobki.split("_");
        int count = 0;

        for (int i = 0; i < arr.length; i++)
            if (!arr[i].equals("")) count++;
         arr  = s.split("_");
        int max = 0;
        for (int i = 0; i < arr.length; i++)
            if (arr[i].length() > max) max = arr[i].length();
        System.out.println(max + " " + count);

    }
}

import java.util.*;
import java.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;
	PrintWriter out;

	private String next() throws Exception{
		while (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		int n = nextInt();
		char []a = next().toCharArray();
		// int n = a.length;

		int count = 0;
		for(int i = 0; i < n; ++i) {
			if (a[i] == '(') {
				int j = i + 1;
				while(j < n && a[j] != ')') ++j;
				count += count(i + 1, j - 1, a);
			}
		}

		int max = 0;
		int l = 0;
		for(int i = 0; i < n; ++i) {
			if (a[i] == '(') {
				max = Math.max(max, max(l, i - 1, a));
				int j = i;
				while(j < n && a[j] != ')') ++j;
				l = j + 1;
			}
		}
		if (l != n) {
			max = Math.max(max, max(l, n - 1, a));
		}

		out.println(max + " " + count);
		out.close();
	}

	private int count(int l, int r, char []a) {
		int ret = 0, c = 0;
		for(int i = l; i <= r; ++i) {
			if (a[i] == '_') {
				if (c > 0) ++ret;
				c = 0;
			} else {
				++c;
			}
		}
		if (c > 0) ++ret;
		return ret;
	}

	private int max(int l, int r, char []a) {
		int ret = 0, c = 0;
		for(int i = l; i <= r; ++i) {
			if (a[i] == '_') {
				ret = Math.max(ret, c);
				c = 0;
			} else {
				++c;
			}
		}
		ret = Math.max(ret, c);
		return ret;
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Scanner;

public class Pb {

	public static void main(String[] args) throws NumberFormatException, IOException {

	Scanner s = new Scanner(System.in);
	BufferedReader br= new BufferedReader (new InputStreamReader(System.in));
	ArrayList<String > arr = new ArrayList<>();
	ArrayList<Integer > ar = new ArrayList<>();
	int tam = Integer.parseInt(br.readLine());
	String cad= br.readLine();
	String word ="";

	int cont = 0, mayor=0;
	boolean flg= false;

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

		if(cad.charAt(i)=='('){
			if (cont >= mayor){
				mayor=cont;
				cont=0;
			}
			cont=0;
			flg=true;
			continue;
		}

		if(cad.charAt(i)==')' ){
			flg=false;
			if(word!=""){
				arr.add(word);
				word= "";
			}
			continue;

		}
		else if(flg==true && cad.charAt(i)!='_'){
			word+=cad.charAt(i);
			continue;

		}

		else if(flg== true && cad.charAt(i)=='_' && word!=""){
			arr.add(word);
			word="";
			continue;
		}

		else if(flg == false && cad.charAt(i)!='_'){
			cont++;
			if(i==(tam-1) && cont>= mayor){
				mayor=cont;
			}
			continue;

		}
		else if ( flg==false && cad.charAt(i)=='_'){
			if (cont >= mayor){
				mayor=cont;
				cont=0;
			}
			cont=0;
		}

	}
	//System.out.println(arr);

	System.out.println(mayor + " "+ arr.size());

	}

}

import java.util.*;
import java.io.*;
import java.math.*;
public final class Solution
{
	static int[] arr;
    public static void main(String[] args)
    {
    	 Reader input = new Reader();
         PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
         int n = input.nextInt();
         char[] s = input.next().toCharArray();
         int maxLength = 0 , words = 0 , temp = 0;
         char previous = '_';
         for(int i = 0 ; i < n ; i++)
         {
        	 if(previous == '(' && s[i] != ')')
        		 continue;
        	 if(previous == '_' || previous == ')')
        	 {
        		 if(s[i] != '_' && s[i] != '(')
        		 {
        			 temp++;
        		 }
        		 else
        		 {
        			 previous = s[i];
        			 if(temp > maxLength)
        				 maxLength = temp;
        			 temp = 0;
        		 }
        	 }
        	 else
        		 previous = s[i];
         }
         if(temp > maxLength)
        	 maxLength = temp;
         previous = s[0];
         temp = 0;
         for(int i = 1 ; i < n ; i++)
         {
        	 if(previous == '(')
        	 {
        		 if(s[i] != '_' && s[i] != ')')
        		 {
        			 temp++;
        		 }
        		 else if(s[i] == '_')
        		 {
        			 if(temp > 0)
        				 words++;
        			 temp = 0;
        		 }
        		 else
        		 {
        			 previous = s[i];
        			 if(temp > 0)
        				 words++;
        			 temp = 0;
        		 }
        	 }
        	 else
        		 previous = s[i];
         }
         out.println(maxLength + " " + words);
		 out.close();
    }
    public static class Reader
    {
    	BufferedReader br;
    	StringTokenizer st;
    	public Reader()
    	{
    		br = new BufferedReader(new InputStreamReader(System.in));
    	}
    	public String next()
    	{
    		try
    		{
        		if(st == null || !st.hasMoreTokens())
        			st = new StringTokenizer(br.readLine());
    		}
    		catch(IOException ex)
    		{
    			ex.printStackTrace();
    			System.exit(1);
    		}
    		return st.nextToken();
    	}
    	public int nextInt()
    	{
    		return Integer.parseInt(next());
    	}
    	public double nextDouble()
    	{
    		return Double.parseDouble(next());
    	}
    	public long nextLong()
    	{
    		return Long.parseLong(next());
    	}
    	public String nextLine()
    	{
    		try
    		{
    			return br.readLine();
    		}
    		catch(IOException ex)
    		{
    			ex.printStackTrace();
    			System.exit(1);
    		}
    		return "";
    	}
    }
}

import java.util.Scanner;

public class Prepare {

	public static void main(String[] args) {
		Scanner sc  = new Scanner(System.in);
		int a;
		a = sc.nextInt();
		String in = sc.next();
		int len = 0;
		int tmp = 0;
		int count = 0;
		boolean bl = false;
		boolean prev = false;
		for(int i = 0; i < in.length(); i++){
			if( ((96 < in.charAt(i) - 0) && (in.charAt(i) < 123)) || (in.charAt(i) > 64 && in.charAt(i) < 91)){
			if(bl && !prev)
				count++;
			if(!bl)
			len++;
			if(len > tmp)
				tmp = len;
			prev = true;
			}

			else if(in.charAt(i) == '_'){
				prev = false;
				if(len > tmp)
				tmp = len;
				len = 0;
				}

			else if(in.charAt(i) == '('){
				prev = false;
				bl = true;
				if(len > tmp)
					tmp = len;
				len = 0;
			}
			else if(in.charAt(i) == ')'){
				bl = false;
				prev = false;
				if(len > tmp)
					tmp = len;
				len = 0;
			}
		}
		System.out.println(tmp+" "+count);
	sc.close();
	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int len = in.nextInt();
            in.nextLine();
            char[] file = in.next().toCharArray();
            if (file[0] != '_' && file[0] != '(')
                file = ("_" + new String(file)).toCharArray();
            if (file[file.length - 1] != '_' && file[file.length - 1] != ')')
                file = (new String(file) + "_").toCharArray();
            int max = 0, inparan = 0;
            int cnt = 0;
            for (int i = 0; i < file.length; i++) {
                if (file[i] == '(') {
                    max = Math.max(cnt, max);
                    cnt = 0;
                    while (file[i] != ')') {
                        i++;
                    }
                    continue;
                }
                if (file[i] == '_') {
                    max = Math.max(cnt, max);
                    cnt = 0;
                } else {
                    cnt++;
                }
            }
            for (int i = 1; i < file.length; i++) {
                if (file[i - 1] == '(') {
                    while (file[i] != ')') {
                        if (file[i] == '_' && (file[i - 1] != '(' && file[i - 1] != '_')) {
                            inparan++;
                        }
                        i++;
                    }
                    if (file[i - 1] != '(' && file[i - 1] != '_') {
                        inparan++;
                    }
                }
            }
            out.write(Integer.toString(max) + " " + Integer.toString(inparan));
        }

    }
}

import java.util.Arrays;
import java.util.Scanner;

public class CodeForces
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		scan.next();
		String s = scan.next();
		String[] out = s.replaceAll("\\([^)]*\\)", " ").replaceAll("_", " ").trim().split(" +");
		int a = 0;
		for (int i = 0; i < out.length; i++)
			a = Math.max(a, out[i].length());
		String[] par = s.replaceAll("(^|\\))[^(]*(\\(|$)", " ").replaceAll("_", " ").trim().split(" +");
		int b = par.length == 1 && par[0].equals("") ? 0 : par.length;
		System.out.println(a+" "+b);
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Scanner;

public class easy {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		boolean skb=false;
		String temp="";
		int max=0;
		ArrayList<String> arr=new ArrayList<>();
		Scanner in=new Scanner(System.in);
		int how=in.nextInt();
		char c;
		in.nextLine();
		String s=in.nextLine();
		char[] WTF=s.toCharArray();
		int i=0;
		while(i<WTF.length){
			c=WTF[i++];
			if(c=='('){
				skb=true;
				if(temp.length()>max){
					max=temp.length();
				}
				temp="";
			}
			if(c==')'){
				skb=false;
				if(temp.length()>0){
					arr.add(temp);
					temp="";
				}
			}
			if(Character.isLetter(c)==true) temp+=c;
			if(c=='_' && skb==false){
				if(temp.length()>max){
					max=temp.length();
				}
				temp="";
			}
			if(c=='_' && skb==true){
				if(temp.length()>0){
					arr.add(temp);
					temp="";
				}
			}
			//System.out.print(c);
		}
	//	System.out.println(arr);
		if(temp.length()>max){
			max=temp.length();
		}
		temp="";
		System.out.println(max+" "+arr.size());
	}
}

import java.util.Scanner;

public class Main {

	public static int Num;
	public static String Line;

	public static void main(String[] args) {

			Scanner buff = new Scanner(System.in); //new Scanner(new FileReader("/root/eclipse_workspace/java_workspace/codeforces/src/codeforces/C_723B.txt"));

			while(buff.hasNextLine()){
				String num = buff.nextLine();
				Num = Integer.parseInt(num);
				Line = buff.nextLine();
				char[] Text = Line.toCharArray();

				int i, maxVal = 0, wordCount = 0, wordLen = 0;
				for(i=0;i<Num;i++){

					if(Text[i]!='_'&& Text[i]!='('&&Text[i]!=')'){
						wordLen++;
					}
					else if(Text[i]=='_'){
						if(wordLen>maxVal){
							maxVal = wordLen;
						}
						wordLen = 0;
					}
					else if(Text[i]=='('){

						if(wordLen>maxVal){
							maxVal = wordLen;
						}
						wordLen = 0;

						i++;

						while(Text[i]!='\0'){

							if(Text[i]!='_'&& Text[i]!='('&&Text[i]!=')'){
								wordLen++;
								i++;
							}
							else if(Text[i]=='_'){
								if(wordLen!=0)
									{
										wordCount++;
										wordLen = 0;
									}
								i++;
								if(Text[i]==')')
									break;
							}
							else if(Text[i]==')')
							{
								if(wordLen!=0)
								{
									wordCount++;
									wordLen = 0;
								}
							//	i++;
								break;
							}

						}
					}

				}

				if(wordLen>maxVal){
					maxVal = wordLen;
				}
				wordLen = 0;

				System.out.println(maxVal + " " + wordCount);

			}

	}

}

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

/**
 * Oct 3, 2016 | 12:28:10 PM
 *

 * Description
 *
 *

 *
 * @author Essiennta Emmanuel (colourfulemmanuel@gmail.com)
 */
public class ProblemB {

    private void solve(char[] a, PrintWriter out) {
        int i = 0;
        int one = 0;
        int two = 0;
        boolean insideParenthesis = false;
        while (i != a.length) {
            if (a[i] == '(') {
                insideParenthesis = true;
            } else if (a[i] == ')') {
                insideParenthesis = false;
            } else if (Character.isLetter(a[i]))
                i--;
            if (insideParenthesis) { // inside
                while (++i != a.length && a[i] != ')' && !Character.isLetter(a[i]));
                if (i == a.length || !Character.isLetter(a[i])) {
                    continue;
                }
                while (Character.isLetter(a[++i]));
                two++;
            } else {
                while (++i != a.length && a[i] != '(' && !Character.isLetter(a[i]));
                if (i == a.length || !Character.isLetter(a[i])) {
                    continue;
                }

                int j = i;
                while (++i != a.length && Character.isLetter(a[i]));
                one = Math.max(one, i - j);
            }
        }
        out.println(one + " " + two);
    }

    public static void main(String[] args) throws IOException {
        try (BufferedReader in = new BufferedReader(new InputStreamReader(args.length == 0 ? System.in : new FileInputStream(args[0])));
                PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {
            in.readLine();
            new ProblemB().solve(in.readLine().toCharArray(), out);
        }
    }
}

import java.io.*;
import java.util.*;
public class TextEditing{
    public static int maxLength(String s){
        String t="";
        boolean f=false;
        char ch;
        for(int i=0;i<s.length();i++){
            ch=s.charAt(i);
            if(ch=='(')
                f=true;
            else if(ch==')')
            {f=false;t+="_";}
            if(!f && ch!=')')
                t+=ch;
        }
        //System.out.println("t is "+t);
        String arr[]=t.split("_");
        int max=0;
        for(int i=0;i<arr.length;i++)
            max=Math.max(max,arr[i].length());
        return max;
    }
    public static int count(String s){
        String arr[]=s.split("_");
        int m=0;
        for(int i=0;i<arr.length;i++){
            if(arr[i].length()!=0)
                m++;
        }
        return m;
    }
    public static int words(String s){
        int c=0;
        String t="";
        boolean f=false;
        for(int i=0;i<s.length();i++){
            char ch=s.charAt(i);
            if(ch=='(')
                f=true;
            else if(ch==')'){
                f=false;
                c+=count(t);
                t="";
            }
            if(f && ch!='(')
                t+=ch;
        }
        return c;
    }
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String s=sc.next();
        System.out.println(maxLength(s)+" "+words(s));
    }
}

import java.util.Scanner;
import java.lang.Math;

public class Document{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);

        int strLength = scan.nextInt();

        String str = scan.next();

        String[] insides = str.replaceAll("(\\)|^).*?(\\(|$)","_").replaceAll("^_+","").replaceAll("_+$","").split("_+");

        String[] outsides = str.replaceAll("\\(.*?\\)","_").split("_+");
        int insideCount = 0;

        for(String s : insides){
            if(s.length() != 0)
            insideCount++;
        }
        int longest = 0;
        for(String s : outsides){
            if(s.length() > longest){
                longest = s.length();
            }
        }
        System.out.println(longest + " " + insideCount);
    }
}

import java.util.*;

public class Test {

	public static void main(String[] args) {
		ArrayList<String> arr1 = new ArrayList<>();
		ArrayList<String> arr2 = new ArrayList<>();
		Scanner in = new Scanner(System.in);
		int n, flag = 0;
		n = in.nextInt();
		String s = "", str = in.next();
		str += "^";
		n++;
		char[] input = new char[256];
		for (int i = 0; i < n; i++) {
			input[i] = str.charAt(i);
		}
		for (int i = 0; i < n; i++) {
			if (input[i] == '(') {
				flag = 1;
				input[i] = '^';
				continue;
			} else if (input[i] == ')') {
				flag = 0;
				arr2.add(s);
				input[i] = '^';
				s = "";
			}
			if (flag == 1) {
				s += input[i];
				input[i] = '^';
			}
		}
		s = "";
		for (int i = 0; i < n; i++) {
			if (input[i] == '^') {
				if (s.isEmpty() == true)
					continue;
				arr1.add(s);
				s = "";
			} else
				s += input[i];
		}
		int max = 0;
		int count = 0;
		for (int i = 0; i < arr1.size(); i++) {
			String temp = arr1.get(i);
			temp += "_";
			for (int j = 0; j < temp.length(); j++) {
				if (Character.isLetter(temp.charAt(j)) == true) {
					count++;
				} else if (temp.charAt(j) == '_') {
					max = Math.max(max, count);
					count = 0;
				}
			}
		}
		count = 0;
		for (int i = 0; i < arr2.size(); i++) {
			String temp = arr2.get(i);
			temp += "_";
			String m = "";
			for (int j = 0; j < temp.length(); j++) {
				if (Character.isLetter(temp.charAt(j)) == true) {
					m += temp.charAt(j);
				} else if (temp.charAt(j) == '_' && m.isEmpty() == false) {
					m = "";
					count++;
				}
			}
		}
		System.out.println(max + " " + count);
	}
}

import java.io.IOException;
import java.util.Scanner;

public class B {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
       String line  = sc.nextLine();

        boolean word = false;
        boolean insidePar = false;

        int amountInside = 0;
        int theLongestOut = 0;
        int curLength = 0;

        for (int i = 0; i < n; i++) {
            char c = line.charAt(i);
            if (c == '_') {
                if (word) {
                    word = false;
                    if (insidePar) {
                        amountInside++;
                    } else {
                        theLongestOut = Math.max(curLength, theLongestOut);
                    }
                }
                curLength = 0;
            } else if (c == '(') {
                theLongestOut = Math.max(curLength, theLongestOut);
                word = false;
                insidePar = true;
                curLength = 0;
            } else if (c == ')') {
                if (word) {
                    word = false;
                    amountInside++;
                }
                insidePar = false;
                curLength = 0;
            } else {
                word = true;
                curLength++;
            }
        }
        theLongestOut = Math.max(curLength, theLongestOut);

        System.out.println(theLongestOut + " " + amountInside);

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    public static int getWords(int a, int b,String s){
        int flag = 0;
        int words =0;
        for(int i=a+1; i<b; i++){
            if(s.charAt(i)!='_'){
                flag = 1;
            }
            if(s.charAt(i)=='_' && flag ==1){
                words++;
                flag =0;
            }
        }
        if(flag==1){
            words++;
        }
        return words;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String s = br.readLine();
        int flg =0;
        int count =0;
        int maxW =0;
        int a = 0;
        int b = 0;
        int w =0;
        for(int i=0; i<s.length(); i++){
            if(s.charAt(i)=='('){
                a = i;
            }
            if(s.charAt(i)==')'){
                b = i;
                w = w + getWords(a,b,s);
            }
        }
        int max =0;
        for(int i=0; i<s.length(); i++){
            if(s.charAt(i)=='('){
                max = Math.max(max, count);
                count =0;
                flg =1;
            }
            if(s.charAt(i)==')'){
                flg =0;
            }else if(s.charAt(i)=='_' && flg==0){
                max = Math.max(max, count);
                count =0;
            }else if(s.charAt(i)!='_' && flg==0){
                count++;
            }
        }
        max = Math.max(max, count);
        System.out.println(max+" "+w);
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author SeeZawL
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            String str = in.nextLine();
            boolean in_par = false, in_word = false;
            int word_cnt = 0, word_len = 0, max_len = 0;

            for (int i = 0; i < n; i++) {
                char c = str.charAt(i);
                if (in_word && (c == '_' || c == '(' || c == ')' || i == n - 1)) {
                    in_word = false;
                    if (!(c == '_' || c == '(' || c == ')')) {
                        word_len++;
                    }
                    if (in_par) {
                        word_cnt++;
                    } else if (word_len > max_len) {
                        max_len = word_len;
                    }
                    if (c == '(') {
                        in_par = true;
                    }
                    if (c == ')') {
                        in_par = false;
                    }
                    word_len = 0;
                } else if (!in_word && !(c == '_' || c == '(' || c == ')')) {
                    in_word = true;
                    word_len++;
                    if (i == n - 1 && word_len > max_len) {
                        max_len = word_len;
                    }
                } else if (in_word) {
                    word_len++;
                } else if (c == '(') {
                    in_par = true;
                } else if (c == ')') {
                    in_par = false;
                }
            }
            out.printf("%d %d", max_len, word_cnt);
        }

    }

    static class FastReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public FastReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            String str = "";
            try {
                str = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return str;
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.*;

public class bucky{

public static void main (String args[]) {

Scanner input=new Scanner(System.in);

HashMap<Integer, Integer> map= new HashMap<Integer, Integer>();

	//int n=input.nextInt();
	//int a=input.nextInt();
		String saatr=input.nextLine();

	String str=input.nextLine();

	int interior=0;
	while(str.indexOf("__")!=-1){
	str=str.replaceAll("__","_");}

		str=str.replaceAll("[(]","1");
		str=str.replaceAll("[)]","2");

//	System.out.println(str);

	while(str.indexOf("1")!=-1){

	int start=str.indexOf("1");
	int stop=str.indexOf("2");

//	System.out.println(start+"  "+stop);

	String analiza=str.substring(start,stop+1);

	interior+=cuvinte(analiza)*
	(str.length()-str.replaceAll(analiza,"").length())/analiza.length();

//	System.out.println("analiza="+analiza);

	str=str.replaceAll(analiza,"_");
		//System.out.println(str);

	//	System.out.println(str);

	}

		while(str.indexOf("__")!=-1){
	str=str.replaceAll("__","_");}

//	System.out.println(str);

	int poz=0; int start=-1; int maxext=0;

	while(poz<str.length()){

	    while(poz<str.length() && str.charAt(poz)!='_' ) {poz++;}

    //System.out.println(start+"  "+poz);

	    maxext=Math.max(maxext,poz-start-1);

	    start=poz;
	    poz++;

	}

	    System.out.println(maxext+" "+interior);

        }

	public static int cuvinte(String a){

	    String vec=a.replaceAll("1","");
	    vec=vec.replaceAll("2","");

	   int raspuns=0;
	   if(vec.length()>0){

	     raspuns=vec.length()-vec.replaceAll("_","").length();

	    //  System.out.println("raspuns="+raspuns);

	    raspuns++;

	 //   System.out.println("vec="+vec.charAt(0));
	    	//    System.out.println("vec="+vec.charAt(vec.length()-1));

	    if(vec.charAt(0)=='_') {
	    raspuns--;}

	     if(vec.charAt(vec.length()-1)=='_') raspuns--;

	   }

	    return raspuns;

	}

}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.Flushable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * See Text Document
 * Analysis
 *
 * @author Brian Yeicol Restrepo Tangarife
 */
public class CF723BTextDocumentAnalysis {

    static Reader in = new Reader(System.in);
    static Writer out = new Writer(System.out);

    public static void main(String[] args) throws IOException {
        in.next();
        String s = in.next();
        String g = "\\([a-zA-z_]*\\)";
        String[] outsides = s.replaceAll(g, "_").split("_+");
        int longest = 0, length;
        for (String outside : outsides) {
            length = outside.length();
            if (length > longest) {
                longest = length;
            }
        }

        Pattern p = Pattern.compile(g);
        Matcher m = p.matcher(s);
        int words = 0;
        String group, aux;
        while (m.find()) {
            group = m.group();
            aux = group.replaceFirst("\\(_*", "");
            aux = aux.replaceFirst("_*\\)", "");
            if (aux.length() > 0) {
                words += aux.split("_+").length;
            }
        }

        out.println(longest, words);
        in.close();
        out.flush();
        out.close();
    }

    ////////////////////////////////////////////////////////////////////////////
    /////////////////////////////  INPUT / OUTPUT  /////////////////////////////
    ////////////////////////////////////////////////////////////////////////////
    static class Reader implements Closeable {

        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public Reader(InputStream input) {
            reader = new BufferedReader(
                    new InputStreamReader(input));
            tokenizer = new StringTokenizer("");
        }

        private StringTokenizer getTokenizer() throws IOException {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                String line = nextLine();
                if (line == null) {
                    return null;
                }
                tokenizer = new StringTokenizer(line);
            }
            return tokenizer;
        }

        public boolean hasNext() throws IOException {
            return getTokenizer() != null;
        }

        public String next() throws IOException {
            return hasNext() ? tokenizer.nextToken() : null;
        }

        public String nextLine() throws IOException {
            tokenizer = null;
            return reader.readLine();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public float nextFloat() throws IOException {
            return Float.parseFloat(next());
        }

        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        public String[] nextStringArray(int size) throws IOException {
            String[] array = new String[size];
            for (int i = 0; i < size; i++) {
                array[i] = next();
            }
            return array;
        }

        public int[] nextIntArray(int size) throws IOException {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = nextInt();
            }
            return array;
        }

        public long[] nextLongArray(int size) throws IOException {
            long[] array = new long[size];
            for (int i = 0; i < size; i++) {
                array[i] = nextLong();
            }
            return array;
        }

        public double[] nextDoubleArray(int size) throws IOException {
            double[] array = new double[size];
            for (int i = 0; i < size; i++) {
                array[i] = nextDouble();
            }
            return array;
        }

        @Override
        public void close() throws IOException {
            tokenizer = null;
            reader.close();
        }
    }

    static class Writer implements Closeable, Flushable {

        private final PrintWriter writer;

        public Writer(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        @Override
        public void close() {
            writer.close();
        }

        @Override
        public void flush() {
            writer.flush();
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class main{
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader entrada = new BufferedReader(new InputStreamReader(System.in));
		int cantidad = Integer.parseInt(entrada.readLine());
		int max = 0, palabras = 0, num1 = 0, num2 = 0;
		boolean dentro = false;
		String frase = entrada.readLine();
		char[] c = new char[cantidad];
		c = frase.toCharArray();
		for(int i=0;i<cantidad;i++){
			if(c[i]=='('){
				dentro = true;
				num1 = 0;
			}else if(c[i]==')'){
				dentro = false;
				if(num2>0){
					palabras++;
					num2 = 0;
				}
			}else{
				if(dentro){
					if(c[i]!='_'){
						num2++;
					}else{
						if(num2>0){
							palabras++;
							num2 = 0;
						}
					}
				}else{
					if(c[i]!='_'){
						num1++;
					}else{
						num1 = 0;
					}
				}
			}
			if(num1>=max){
				max = num1;
			}
		}
		System.out.println(max);
		System.out.println(palabras);
	}
}

import java.util.*;
import java.io.*;
public class Text_Document_Analysis
{
	public static void main(String args[]) throws Exception
	{
		BufferedReader f=new BufferedReader(new InputStreamReader(System.in));
		// BufferedReader f=new BufferedReader(new FileReader("Text_Document_Analysis.in"));
		f.readLine();
		String temp=f.readLine();
		String[] arr1=temp.split("\\([a-zA-Z_]*\\)");
		int one=0;
		for(int x=0;x<arr1.length;x++)
		{
			String[] temparr=arr1[x].split("_+");
			for(int y=0;y<temparr.length;y++)
				one=Math.max(one,temparr[y].length());
		}
		int pos=0;
		int two=0;
		boolean flag=false;
		boolean flag1=false;
		for(int x=0;x<temp.length();x++)
		{
			if(temp.charAt(x)=='(')
				flag=true;
			if(temp.charAt(x)==')')
			{
				flag1=false;
				flag=false;
			}
			if(flag&&temp.substring(x,x+1).matches("[a-zA-Z]"))
			{
				if(flag1) continue;
				two++;
				flag1=true;
			}
			if(temp.substring(x,x+1).matches("_"))
				flag1=false;
		}
		System.out.println(one+" "+two);
	}
}

public class ProblemB {

  public static void main(String[] args) {
    try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
      sc.nextLine();
      char[] a = sc.nextLine().toCharArray();
      int i = 0;
      int one = 0, two = 0;
      while (i != a.length) {
        if (a[i] == '(') {
          while (a[i] != ')') {
            while (a[++i] != ')' && !Character.isLetter(a[i]));
            if (a[i] == ')') continue;
            while (Character.isLetter(a[++i]));
            two++;
          }
        } else {
          while (i != a.length && a[i] != '(' && !Character.isLetter(a[i])) i++;
          if (i == a.length || a[i] == '(') continue;
          int j = i;
          while (++i != a.length && Character.isLetter(a[i]));
          one = Math.max(one, i - j);
        }
      } // end while
      System.out.println(one + " " + two);
    } // end try
  } // end main()
}

 import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.lang.*;
public class Main{
	static long mod=1000000007;
//	static public HashMap<String,Integer> map=new HashMap<String,Integer>();
	//static public HashMap<Integer, String> map1=new HashMap<Integer,String>();

    public static void main(String[] args) throws Exception{
    	 InputReader in = new InputReader(System.in);
    	PrintWriter pw=new PrintWriter(System.out);
    	int n=in.readInt();
		String s=in.readString();
		char[] arr=s.toCharArray();
		int max_length=0;
		int len1=0;
		int words=0;
		int flag=0;
		//int flag1=0;
		for(int i=0;i<n;i++){
			if(arr[i]=='_'){
				//pw.println(flag);
				if(len1>max_length && flag==0)
					max_length=len1;
				if(flag==1 && len1>0){
					//pw.println(arr[i-1]);
					words++;
				}
				len1=0;
			}else if(arr[i]=='('){
				flag=1;
				if(len1>max_length)
					max_length=len1;
				len1=0;
			}else if(arr[i]==')'){
				flag=0;
				if(len1>0)
					words++;
				len1=0;
			}else{
				len1++;
			}
		}
		if(len1>max_length)
			max_length=len1;
		System.out.println(max_length+" "+words);
    }
//    for(int i=0;i<out.l)

	static class Pair implements Comparable<Pair>
	{
		int a;
		int b;
		@Override
		public int compareTo(Pair o)
		{
			if(o.b>this.b) return 1;
			if(o.b<this.b) return -1;
			return 0;
		}

	}
public static int BinarySearch(long temp,long[] sum,int r)
{
	int l=0;

	while(l<=r)
	{
		int mid=l+(r-l)/2;
		if(sum[mid]==temp&&sum[mid]!=-1)
		{
		return mid;
		}
		if(sum[mid]>temp&&sum[mid]!=-1)
			r=mid-1;
		if(sum[mid]<temp&&sum[mid]!=-1)
			l=mid+1;
    }
	return -1;
}
public static long gcd(long x,long y)
{
	if(x%y==0)
		return y;
	else
		return gcd(y,x%y);
}
public static int gcd(int x,int y)
{
	if(x%y==0)
		return y;
	else
		return gcd(y,x%y);
}
public static int abs(int a,int b)
{
	return (int)Math.abs(a-b);
}
public static long abs(long a,long b)
{
	return (long)Math.abs(a-b);
}
public static int max(int a,int b)
{
	if(a>b)
		return a;
	else
		return b;
}
public static int min(int a,int b)
{
	if(a>b)
		return b;
	else
		return a;
}
public static long max(long a,long b)
{
	if(a>b)
		return a;
	else
		return b;
}
public static long min(long a,long b)
{
	if(a>b)
		return b;
	else
		return a;
}

public static long pow(long n,long p,long m)
{
	 long  result = 1;
	  if(p==0)
	    return 1;
	if (p==1)
	    return n;
	while(p!=0)
	{
	    if(p%2==1)
	        result *= n;
	    if(result>=m)
	    result%=m;
	    p >>=1;
	    n*=n;
	    if(n>=m)
	    n%=m;
	}
	return result;
}
public static long pow(long n,long p)
{
	long  result = 1;
	  if(p==0)
	    return 1;
	if (p==1)
	    return n;
	while(p!=0)
	{
	    if(p%2==1)
	        result *= n;
	    p >>=1;
	    n*=n;
	}
	return result;

}

static long sort(int a[])
{  int n=a.length;
	int b[]=new int[n];
	return mergeSort(a,b,0,n-1);}
static long mergeSort(int a[],int b[],long left,long right)
{ long c=0;if(left<right)
 {   long mid=left+(right-left)/2;
	 c= mergeSort(a,b,left,mid);
	 c+=mergeSort(a,b,mid+1,right);
	 c+=merge(a,b,left,mid+1,right); }
	return c;	 }
static long merge(int a[],int  b[],long left,long mid,long right)
{long c=0;int i=(int)left;int j=(int)mid; int k=(int)left;
while(i<=(int)mid-1&&j<=(int)right)
{ if(a[i]<=a[j]) {b[k++]=a[i++]; }
else	{ b[k++]=a[j++];c+=mid-i;}}
while (i <= (int)mid - 1)   b[k++] = a[i++];
while (j <= (int)right) b[k++] = a[j++];
for (i=(int)left; i <= (int)right; i++)
	a[i] = b[i];  return c;  }

public static int[] radixSort(int[] f)
{
	int[] to = new int[f.length];
	{
		int[] b = new int[65537];
		for(int i = 0;i < f.length;i++)b[1+(f[i]&0xffff)]++;
		for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
		for(int i = 0;i < f.length;i++)to[b[f[i]&0xffff]++] = f[i];
		int[] d = f; f = to;to = d;
	}
	{
		int[] b = new int[65537];
		for(int i = 0;i < f.length;i++)b[1+(f[i]>>>16)]++;
		for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
		for(int i = 0;i < f.length;i++)to[b[f[i]>>>16]++] = f[i];
		int[] d = f; f = to;to = d;
	}
	return f;
}
   static  class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                } catch (IOException e)
                {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
        public double readDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, readInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
        public long readLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next()
        {
            return readString();
        }

        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }
}

import java.io.*;
import java.util.*;

public class textdocumentanalysis {
	static int count_inside_braces = 0, longest_word = 0;

	public static int remove_underscore(String str) {
		str = str.replaceAll("_", " ");
		str = str.trim().replaceAll(" +", " ");
		String s[] = str.split(" ");
		if (s.length == 1 && s[0].equals(""))
			return 0;
		return s.length;
	}

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		ArrayList<Integer> braces_indices = new ArrayList<Integer>();
		braces_indices.add(-1);
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == '(' || s.charAt(i) == ')')
				braces_indices.add(i);
		}
		int i = 1, count = 0, maxl = 0;
		String outside_braces = "";
		while (i < braces_indices.size() - 1) {
			int open_brace_index = braces_indices.get(i);
			int close_brace_index = braces_indices.get(i + 1);
			String inside_braces = s.substring(braces_indices.get(i) + 1, braces_indices.get(i + 1));
			count = remove_underscore(inside_braces);
			count_inside_braces += count;
			outside_braces += "_" + s.substring(braces_indices.get(i - 1) + 1, braces_indices.get(i));
			i += 2;
		}
		outside_braces += "_" + s.substring(braces_indices.get(braces_indices.size() - 1) + 1);
		outside_braces = outside_braces.replaceAll("_", " ");
		outside_braces = outside_braces.trim().replaceAll(" +", " ");
		String s_new[] = outside_braces.split(" ");
		for (int j = 0; j < s_new.length; j++) {
			if (s_new[j].length() > maxl)
				maxl = s_new[j].length();
		}

		System.out.print(maxl + " " + count_inside_braces);
	}
}

import java.util.*;
public class B723 {
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		String s=sc.next();
		int sum=0;
		int tmp=0;
		int su=0;
		String temp="";
		for(int i=0;i<a;i++)
		{
			if(s.charAt(i)=='(')
			{
				i++;
				if(tmp>sum)
					sum=tmp;
				tmp=0;
				while(s.charAt(i)!=')')
				{
					temp=temp+s.charAt(i);
					i++;
				}
				StringTokenizer st=new StringTokenizer(temp,"_");
				su=su+st.countTokens();
				temp="";
			}
			else if(s.charAt(i)=='_')
			{
				if(tmp>sum)
					sum=tmp;
				tmp=0;
			}
			else
			{
				tmp++;
			}
		}
		if(tmp>sum)
			sum=tmp;
		StringTokenizer st1=new StringTokenizer(temp,"_");
		su=su+st1.countTokens();
		System.out.println(sum+" "+su);
		sc.close();
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class codeforces {

    public static int Binary(int x,int array[]){
        int min=0;
        int max=array.length-1;
        int mid=0;
        while(min<max){
            mid=(max+min)/2;
            if (array[mid]==x)return mid;
            if (x>array[mid])min=mid+1;
            if (x<array[mid])max=mid-1;

        }

    return 0;}

    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        int n=Reader.nextInt(),max=0,countw=0;
        String x=Reader.next();
        char ch[]=x.toCharArray();
        for (int i = 0; i < n; i++) {
            if(ch[i]!='_'&&ch[i]!='('){
            int count=0;
                for (int j = i; j < n; j++) {
                    if(ch[j]!='_'&&ch[j]!='(')count++;
                    if(ch[j]=='_'||ch[j]=='('||j==n-1){max=Math.max(max, count);i=j;count=0;break;}
                    }

            }
            if (ch[i]=='('){int count=0;
                for (int j = i; j < n; j++) {
                 if((ch[j]=='_'||ch[j]==')')&&count>0){countw++;count=0;}
                    if(ch[j]==')'){i=j;break;}
                     if(ch[j]!='_'&&ch[j]!='(')count++;

                }

            }

        }
        System.out.println(max+" "+countw);

    }

}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;
    static void init(InputStream input) {
        reader = new BufferedReader(new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }
    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}

import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class CF375B {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.nextLine());
        String s1 = sc.next().toLowerCase();
        String s2 = s1;
        char ch[] = s1.toCharArray();

        /*StringTokenizer st = new StringTokenizer(s2, "()");
        while(st.hasMoreTokens())
        {
        	System.out.println(st.nextToken());
        }*/

        StringBuilder sb = new StringBuilder(s2);
      Stack st = new Stack();

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

        		st.push(sb.charAt(i));

        }
        List<Integer>list = new ArrayList<Integer>();
        List<Character>list2 = new ArrayList<Character>();
        for(int i = 0; i <ch.length;i++)
        {

        		if(ch[i]=='(')
        		{
        			st.pop();
        			list.add(i);
        		}
        		if(ch[i]==')')
        		{
        			st.pop();
        			list.add(i);
        		}

        }
        int l = 0;
        TreeMap<Integer, Integer> map = new TreeMap<Integer, Integer>();
        for(int i = 0; i<list.size();i = i+2)
        {
        	map.put(list.get(i), list.get(i+1));
        }
        List<Integer>list3 = new ArrayList<Integer>();
        for(Map.Entry<Integer, Integer>m:map.entrySet())
        {
        	int k = m.getKey();
        	int k1 = m.getValue();
        	for(int i = k; i<=k1;i++)
        	{
        		list3.add(i);
        	}
        }
        char c[] = new char[s1.length()-list3.size()];
        char c2[] = new char[list3.size()];
        int in = 0;
        int in2 = 0;
        String fin = "";
        for(int i = 0; i <ch.length;i++)
        {
        	if(!list3.contains(i))
        	{
        		c[in] = ch[i];
        		in++;

        	}

        }
        boolean b = true;
        for(int i = 0; i <ch.length;i++)
        {
        	if(list3.contains(i))
        	{
        	  if(ch[i]=='(' || ch[i]==')'||ch[i]=='_')
        	  {
        		  if(b==true)
        		  {
        		  c2[in2] = ' ';
        		  in2++;
        		  b=false;
        		  }
        	  }
        	  else
        		  {
        		  c2[in2] = ch[i];

        		in2++;
        		b=true;
        		  }
        	}
        }
        for(int i = 0; i <c.length;i++)
        {
        	//System.out.print(c[i]+" ");
        	fin = fin+Character.toString(c[i]);
        }
        fin = fin.replaceAll("_", " ");
        String fina[] = fin.split(" ");
        List<Integer>list4 = new ArrayList<Integer>();
        for(int i = 0; i <fina.length;i++)
        {
        	list4.add(fina[i].length());
        	//System.out.println(fina[i]);

        }
        Collections.sort(list4);
        /*if(list4.size()==0)
        {
          System.out.print(0);
        }

        else
        	{
        	System.out.print(list4.get(list4.size()-1));
        	}*/

        String pan = "";
        for(int i = 0; i <c2.length;i++)
        {

        	pan = pan+Character.toString(c2[i]);
        }

        String pa[] = pan.split(" ");
        List<Integer>list5 = new ArrayList<Integer>();
        for(int i = 0; i <pa.length;i++)
        {
        	String ba = pa[i].trim();
        	if(ba.length()!=0)
        	{
        	list5.add(pa[i].length());
        	}
        }

        String str = s1.replaceAll("\\(.*?\\) ?", " ");
        //System.out.println(str);
        str = str.replace("_", " ");
        String string[] = str.split(" ");
        List<Integer>list8 = new ArrayList<Integer>();
        for(int i = 0; i <string.length;i++)
        {
        	String ba = string[i].trim();
        	if(ba.length()!=0)
        	{
        	list8.add(string[i].length());
        	}
        }
        Collections.sort(list8);
        if(list8.size()==0)
        {
          System.out.print(0);
        }

        else
        	{
        	System.out.print(list8.get(list8.size()-1));
        	}
        System.out.print(" "+list5.size());
        }

	}

//package B;
import java.io.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String s=sc.next();
		int flag1=0;
		int flag2=0;
		int flag3=0;
		int max=-1;
		int cur=0;
		int cur2=0;
		int number=0;
		boolean start=false;
		for(int i=0;i<n;i++){

			if(flag2==0){
				if(isAlpha(s.charAt(i))){
					cur++;
					//System.out.println(cur);
				}
				if(cur>0&&s.charAt(i)=='_'){
					max=Math.max(max, cur);
					cur=0;
				}
				if(cur>0&&s.charAt(i)=='('){
					max=Math.max(max, cur);
					cur=0;
				}

				}
		    if(flag2==1){
		    	if(isAlpha(s.charAt(i))){
		    		cur2++;
		    	}
		    	if(s.charAt(i)=='_'||s.charAt(i)==')'){
		    		if(cur2>0){
		    			number++;
		    			cur2=0;
		    		}
		    	if(s.charAt(i)==')'){
		    		flag2=0;
		    	}
		    	}
		    }
		    if(s.charAt(i)=='('){
				flag2=1;
			}

		}
		if(cur>0){
			max=Math.max(max, cur);
			cur=0;
		}
		if(max==-1){
			System.out.print(0+" ");
		}
		else
		System.out.print(max+" ");
		System.out.println(number);
	}
static boolean isAlpha(char a){
	if((a>='A'&&a<='Z')||(a>='a'&&a<='z')){
		return true;
	}
	else
		return false;
}
}

import java.util.Scanner;
import java.lang.*;

public class cf723b {

	static final Scanner sc = new Scanner(System.in);
	static int[] documentAnalyser(String doc) {
		boolean insideParenthesis = false;
		boolean lastWasLetter = false;

		int longestLength = 0;
		int wordLength = 0;

		int wordsInParentheses = 0;

		for (int i = 0; i < doc.length(); ++i) {
			if (doc.charAt(i) == '(') {
				insideParenthesis = true;
				lastWasLetter = false;
				wordLength = 0;
			}
			else if (doc.charAt(i) == ')') {
				insideParenthesis = false;
				lastWasLetter = false;
				wordLength = 0;
			}
			else if (Character.isLetter(doc.charAt(i))) {
				if (insideParenthesis && !lastWasLetter) {
					wordsInParentheses += 1;
				}
				else if (!insideParenthesis) {
					wordLength += 1;
					longestLength = Math.max(wordLength, longestLength);
				}
				lastWasLetter = true;
			}
			else {
				lastWasLetter = false;
				wordLength = 0;
			}
		}
		int[] valuesOfInterest = {longestLength, wordsInParentheses};
		return valuesOfInterest;
	}
	public static void main(String[] args) {
		int stringLength = sc.nextInt();
		String doc = sc.next();
		int[] analysis = new int[2];
		analysis = documentAnalyser(doc);
		System.out.print(analysis[0] + " " + analysis[1]);
	}
}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here

		int t,i;
		Scanner sc = new Scanner(System.in);

		String s;String ss;
		while(sc.hasNext()) {
		    t = sc.nextInt();
		    s=sc.next();
		    s = s.concat("_");
		    boolean b =false; int max =0; int l=-1; int count =0;
		    for(i=0;i<s.length();i++) {
		        if(s.charAt(i)=='_' || s.charAt(i)=='(' || s.charAt(i)==')' ) {
		           /* if(l==-1) {
		                l=i; continue;
		            }*/
		            if(s.charAt(i)=='(') {
		                    b=true;
		                    if(max<(i-l-1))
		                    max = i-l-1;
		                    l=i; continue;
		                }
		                else if(s.charAt(i)==')')
		                {
		                    b= false;
		                    if(i-l>1)
		                    count++;
		                    l=i; continue;
		                }
		            if(i-l>1)

		            {
		                if(b==true)
		                count++;
		                else {
		                    if(max<(i-l-1))
		                    max = i-l-1;
		                }
		               /* if(s.charAt(i)=='(') {
		                    b=true;
		                }
		                else if(s.charAt(i)==')')
		                {
		                    b= false;
		                }*/
		            }
		            l=i;

		        }
		    }
		    System.out.println(max+" "+count);
		}
	}
}

import java.util.Scanner;
import java.util.Arrays;
import java.lang.Math;

public class Problem
{
	public static boolean IsALetter (char letter)
	{
		int ascii = (int)letter;

		if (ascii >= (int)'a' && ascii <= (int)'z') return true;
		if (ascii >= (int)'A' && ascii <= (int)'Z') return true;
		else return false;

	}
	public static void main(String[] args)
	{
		// Initialization of variables
		int n, max_inside_brackets= 0 , max_outside_brackets = 0, temporary_inside_brackets = 0, temporary_outside_brackets = 0, words = 0;
		String s;
		boolean insideBracket = false, increase_words = true;
		Scanner input = new Scanner(System.in);

		// The input
		n = input.nextInt();
		s = input.next();

		// Start iteratting through the character of the string
		for (int i=0; i<n; i++)
		{
			char current = s.charAt(i); // The character we are currently working with

			//CASE 1: The character is not a letter, nor a bracket
			if (IsALetter(current) == false && current != '(' && current != ')')
			{
				if (insideBracket == true) // Case1.1 Inside a bracket
				{
					max_inside_brackets = Math.max(max_inside_brackets, temporary_inside_brackets);
					temporary_inside_brackets = 0;
					increase_words = true;

				}

				else if (insideBracket == false) //Case1.2 Outside a bracket
				{
					max_outside_brackets = Math.max(max_outside_brackets, temporary_outside_brackets);
					temporary_outside_brackets = 0;
				}
			}

			//CASE 2: The character is a beginning of a bracket
			else if (current == '(')
			{
				max_outside_brackets = Math.max(max_outside_brackets, temporary_outside_brackets);
				temporary_inside_brackets = 0;
				temporary_outside_brackets = 0;
				insideBracket = true;
			}

			//CASE 3: The character is an end of a bracket
			else if (current == ')')
			{
				 max_inside_brackets = Math.max(max_inside_brackets, temporary_inside_brackets);
				 temporary_inside_brackets = 0;
				 insideBracket = false;
				 increase_words = true;
			}
			//CASE 4: The character is a letter, inside a bracket
			else if (insideBracket == true)
			{
				temporary_inside_brackets++;
				if (increase_words == true) words++;
				increase_words = false;

			}

			//CASE 5: The character is a letter, outside a bracket
			else temporary_outside_brackets++;

			//CASE 6: The letter is the last in the string
			if (i == n-1 && IsALetter(current) == true)
			{
				max_outside_brackets = Math.max(max_outside_brackets, temporary_outside_brackets);
			}
		}

		System.out.print(max_outside_brackets);
		System.out.print(" " + words);
	}
}

//Rajkin Hossain.......
import java.io.*;
import java.util.*;
public class B{

    public static void main(String [] args)throws IOException{
        //FI k = new FI("E:/b.txt");
    	FI k = new FI(System.in);
    	//Scanner k = new Scanner(new File("E:/b.txt"));
    	PrintWriter z = new PrintWriter(System.out);
    	while(k.hasNext()){
    		int n = k.nextInt();
    		String s = k.next();
    		boolean ok = false;
    		int one = 0;
    		String tt = "";
    		String twoans = "";
    		boolean wordnok = true;
    		for(int c = 0;c<n;c++){
    			char ch = s.charAt(c);
    			if(ch == '('){
    				ok = true;
    				wordnok = true;
    				tt = "";
    			}
    			else if(ch == ')'){
    				tt = "";
    				ok = false;
    			}
    			else{
    				if(ok == false){

    					if(ch == '_'){
    						tt = "";
    					}
    					else{
    						tt += ch;
    					}

    					if(tt.length()>twoans.length()){
							twoans = tt;
						}
    				}
    				else{
    					if(ch == '_'){
    						wordnok = true;
    					}
    					else{
    						if(wordnok){
    							one++;
    							wordnok = false;
    						}
    					}
    				}
    			}

    		}
    		z.println(twoans.length()+" "+one);
    	}

       	z.flush();

    }

	public static class FI {
	    BufferedReader br;
	    StringTokenizer st;

	    public FI(InputStream stream){
	        br = new BufferedReader(new InputStreamReader(stream));
	    }

	    public FI(String s){
	        try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	    }

	    public String next() {
	        return nextToken();
	    }

	    public boolean hasNext(){
	    	try {
				return br.ready();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			return false;
	    }

	    public String nextToken() {
	        while (st == null || !st.hasMoreTokens()) {
	            String line = null;
	            try {
	                line = br.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	            if (line == null) {
	                return null;
	            }
	            st = new StringTokenizer(line);
	        }
	        return st.nextToken();
	    }

	    public int nextInt() {
	        return Integer.parseInt(nextToken());
	    }

	    public long nextLong() {
	        return Long.valueOf(nextToken());
	    }

	}

    public static class FO extends PrintWriter {
        FO() { super(new BufferedOutputStream(System.out)); }
    }

}

import java.util.Scanner;

public class Text_Document_Analysis {

	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int n=scanner.nextInt();
		StringBuffer string=new StringBuffer(scanner.next());
		StringBuffer underScore=new StringBuffer();
		StringBuffer Bracket=new StringBuffer();
		int i=0,count=0,max=0,max2=0;
		while(i<n)
		{
			if(string.charAt(i)=='(')
			{
				i++;
				while(string.charAt(i)!=')')
				{
					Bracket.append(string.charAt(i));
					i++;
				}
				i++;
				Bracket.append("_");
				underScore.append("_");

			}
			else {
				underScore.append(string.charAt(i));
				i++;
			}
		}
		underScore.append("_");Bracket.append("_");
		//System.out.println(underScore+"*****"+Bracket);
		for(int j=0;j<underScore.length();j++)
		{
			if(underScore.charAt(j)=='_')
			{
				if(count>max) {
					max=count;
				}
				count=0;
			}
			else
				count++;
		}
		count=0;
		for(int j=0;j<Bracket.length();j++)
		{
			if(Bracket.charAt(j)=='_')
			{
				if(count>0) {
					max2++;
				}
				count=0;
			}
			else
				count++;
		}

		System.out.println(max+" "+max2);
	}

}

import java.io.*;

/**
 * @author Alexander Tsupko (alexander.tsupko@outlook.com)
 *         Copyright (c) All rights reserved.
 */
public class B {
    private static class Solve {
        private static void solve(InputReader in, PrintWriter out) {
            int n1 = 0, n2 = 0;
            boolean flag = false, letter = false;

            int n = in.readInt(), count = 0;
            String s = in.readString();
            for (int i = 0; i < n; i++) {
                if (s.charAt(i) == '(') {
                    n1 = Math.max(n1, count);
                    count = 0;
                    flag = true;
                }
                if (!flag) {
                    if (s.charAt(i) != '_') {
                        count++;
                    } else {
                        n1 = Math.max(n1, count);
                        count = 0;
                    }
                } else {
                    if (s.charAt(i) == ')') {
                        flag = false;
                        if (letter) {
                            n2++;
                            letter = false;
                        }
                    } else {
                        if (s.charAt(i) == '_') {
                            if (letter) {
                                n2++;
                                letter = false;
                            }
                        } else {
                            if (s.charAt(i) != '(') {
                                letter = true;
                            }
                        }
                    }
                }
            }
            n1 = Math.max(n1, count);
            out.print(n1 + " " + n2);
        }
    }

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        Solve.solve(in, out); out.flush();
    }

    private static class InputReader {
        private final InputStream inputStream;
        private int current, size;
        private byte[] buffer = new byte[4096];

        private InputReader(InputStream inputStream) {
            this.inputStream = inputStream;
        }

        private int read() {
            try {
                if (current >= size) {
                    current = 0;
                    size = inputStream.read(buffer);
                    if (size < 0) {
                        return -1;
                    }
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return buffer[current++];
        }

        private int readInt() {
            int sign = 1, abs = 0, c;
            do {
                c = read();
            } while (isEmpty(c));
            if (c == '-') {
                sign = -1;
                c = read();
            }
            do {
                if (c < '0' || c > '9') {
                    throw new IllegalStateException();
                }
                abs = 10 * abs + (c - '0');
                c = read();
            } while (!isEmpty(c));
            return sign * abs;
        }

        private String readString() {
            StringBuilder sb = new StringBuilder();
            int c;
            do {
                c = read();
            } while (isEmpty(c));
            do {
                sb.append((char) c);
                c = read();
            } while (!isEmpty(c));
            return sb.toString();
        }

        private static boolean isEmpty(int c) {
            return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == -1;
        }
    }
}

import java.util.Scanner;

/**
Thanks to Valeh :D
 */

public class TextDocumentAnalysis {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        s.toLowerCase();
        int maxL = -1;
        int nwi = 0;
        int fp = 0;
        int fw = 0;
        for(int i=0;i<n;i++){
            char c = s.charAt(i);
            if(c == '(') {fp++;fw=0;}
            else if(c == ')') {
                if(fp == 1 && fw != 0) nwi++;
                fp--;fw=0;
            }
            else if(c == '_') {
                if(fp == 1 && fw != 0) nwi++;
                fw=0;
            }
            else {
                fw++;
            }
            if(fp==0) maxL = Math.max(fw, maxL);
        }
        System.out.println(maxL + " " + nwi);
    }
}

//_Hello_Vasya(and_Petya)__bye_(and_OK)

    import java.lang.reflect.Array;
    import java.util.Scanner;
    import java.io.*;
    import java.util.*;
    import java.math.*;
    import java.lang.*;
    import static java.lang.Math.*;
    public class main implements Runnable {

        static ArrayList<Integer> adj[];

        static void Check2(int n) {
            adj = new ArrayList[n + 1];
            for (int i = 0; i <= n; i++) {
                adj[i] = new ArrayList<>();
            }

        }

        static void add(int i, int j) {
    adj[i].add(j);
    adj[j].add(i);
        }

        public static void main(String[] args) {
            new Thread(null, new main(), "Check2", 1 << 26).start();// to increse stack size in java
        }

        static long mod = (long) (1e9 + 7);

        public void run() {
                        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
            //Scanner in=new Scanner(System.in);

            InputReader in = new InputReader(System.in);
            PrintWriter w = new PrintWriter(System.out);

                int n=in.nextInt();
                char c[]=in.next().toCharArray();

                int maxin=0;
                int maxout=0;
                int flag=0;
                int co=0;
                int flag2=0;
                for(int i=0;i<c.length;i++){

                    if(c[i]=='_'&&flag==0){
                        continue;
                    }

                    else if(c[i]=='('){
                        flag=1;
                    }
                    else if(c[i]==')'){
                          if(flag2==1)co++;
                        flag=0;
                        flag2=0;
                    }
                    else if(flag==1){
                        if(c[i]=='_'&&flag2==1){
                            flag2=0;

                            co++;

                        }
                        else if(c[i]!='_'){
                            flag2=1;

                        }

                    }

//                    w.println(c[i]+" "+co+" "+flag2);
                }
                maxin=co;
                co=0;
            for(int i=0;i<c.length;i++){

                if(c[i]==')'){
                    flag=0;

                    co=0;
                    continue;
                }
                else if(c[i]=='('){
                    flag=1;
                    co=0;
                }
                if(flag==1)
                {
                    continue;
                }
                    else if(c[i]=='_'){

                    co=0;
                    }
                    else{
                        co++;
                }

                maxout=max(maxout,co);
            }
            w.println(maxout+" "+maxin);

            w.close();
        }

            static class pair{

            int a,b,dis,time;

            pair(int c,int d){
                a=c;
                b=d;
            }

        }

        static long power(long x,long y){
            if(y==0)return 1%mod;
            if(y==1)return x%mod;

            long res=1;
            x=x%mod;
            while(y>0){

                if((y%2)!=0){
                    res=(res*x)%mod;
                }

                y=y/2;
                x=(x*x)%mod;
            }

            return res;

        }

        static  int gcd(int a,int b){

            if(b==0)return a;
            return gcd(b,a%b);
        }

        static  void sev(int a[],int n){

            for(int i=2;i<=n;i++)a[i]=i;
            for(int i=2;i<=n;i++){

                if(a[i]!=0){
                    for(int j=2*i;j<=n;){

                        a[j]=0;
                        j=j+i;
                    }
                }

            }

        }

        static class node{

            int y;
            int val;

            node(int a,int b){

                y=a;
                val=b;

            }

        }

        static class InputReader
        {
            private InputStream stream;
            private byte[] buf = new byte[1024];
            private int curChar;
            private int numChars;
            private SpaceCharFilter filter;

            public InputReader(InputStream stream)
            {
                this.stream = stream;
            }

            public int read()
            {
                if (numChars==-1)
                    throw new InputMismatchException();

                if (curChar >= numChars)
                {
                    curChar = 0;
                    try
                    {
                        numChars = stream.read(buf);
                    }
                    catch (IOException e)
                    {
                        throw new InputMismatchException();
                    }

                    if(numChars <= 0)
                        return -1;
                }
                return buf[curChar++];
            }

            public String nextLine()
            {
                BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
                String str = "";
                try
                {
                    str = br.readLine();
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
                return str;
            }
            public int nextInt()
            {
                int c = read();

                while(isSpaceChar(c))
                    c = read();

                int sgn = 1;

                if (c == '-')
                {
                    sgn = -1;
                    c = read();
                }

                int res = 0;
                do
                {
                    if(c<'0'||c>'9')
                        throw new InputMismatchException();
                    res *= 10;
                    res += c - '0';
                    c = read();
                }
                while (!isSpaceChar(c));

                return res * sgn;
            }

            public long nextLong()
            {
                int c = read();
                while (isSpaceChar(c))
                    c = read();
                int sgn = 1;
                if (c == '-')
                {
                    sgn = -1;
                    c = read();
                }
                long res = 0;

                do
                {
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    res *= 10;
                    res += c - '0';
                    c = read();
                }
                while (!isSpaceChar(c));
                return res * sgn;
            }

            public double nextDouble()
            {
                int c = read();
                while (isSpaceChar(c))
                    c = read();
                int sgn = 1;
                if (c == '-')
                {
                    sgn = -1;
                    c = read();
                }
                double res = 0;
                while (!isSpaceChar(c) && c != '.')
                {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    res *= 10;
                    res += c - '0';
                    c = read();
                }
                if (c == '.')
                {
                    c = read();
                    double m = 1;
                    while (!isSpaceChar(c))
                    {
                        if (c == 'e' || c == 'E')
                            return res * Math.pow(10, nextInt());
                        if (c < '0' || c > '9')
                            throw new InputMismatchException();
                        m /= 10;
                        res += (c - '0') * m;
                        c = read();
                    }
                }
                return res * sgn;
            }

            public String readString()
            {
                int c = read();
                while (isSpaceChar(c))
                    c = read();
                StringBuilder res = new StringBuilder();
                do
                {
                    res.appendCodePoint(c);
                    c = read();
                }
                while (!isSpaceChar(c));

                return res.toString();
            }

            public boolean isSpaceChar(int c)
            {
                if (filter != null)
                    return filter.isSpaceChar(c);
                return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
            }

            public String next()
            {
                return readString();
            }

            public interface SpaceCharFilter
            {
                public boolean isSpaceChar(int ch);
            }
        }

    }

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class pa {

	public static void main(String[] args) throws NumberFormatException, IOException {

	BufferedReader br= new BufferedReader (new InputStreamReader(System.in));
	ArrayList<String > arr = new ArrayList<>();
	ArrayList<Integer > ar = new ArrayList<>();
	int tam = Integer.parseInt(br.readLine());
	String cad= br.readLine();
	String word ="";

	int cont = 0, mayor=0;
	boolean flg= false;

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

		if(cad.charAt(i)=='('){
			if (cont >= mayor){
				mayor=cont;

			}
			cont=0;
			flg=true;
			continue;
		}

		if(cad.charAt(i)==')' ){
			flg=false;
			if(word!=""){
				arr.add(word);
				word= "";
			}
			continue;

		}
		else if(flg==true && cad.charAt(i)!='_'){
			word+=cad.charAt(i);
			continue;

		}

		else if(flg== true && cad.charAt(i)=='_' && word!=""){
			arr.add(word);
			word="";
			continue;
		}

		else if(flg == false && cad.charAt(i)!='_'){
			cont++;
			if(i==(tam-1) && cont>= mayor){
				mayor=cont;
			}
			continue;

		}
		else if ( flg==false && cad.charAt(i)=='_'){
			if (cont >= mayor){
				mayor=cont;
				cont=0;
			}
			cont=0;
		}

	}

	System.out.println(mayor + " "+ arr.size());

	}

}

import java.util.Scanner;

public class WordsFinder {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		int parenthesisCnt = 0;
		int startIndex = s.indexOf('(');
		int endIndex = s.indexOf(')');
		while (startIndex >= 0 || endIndex >= 0) {
			String tempString = s.substring(startIndex + 1, endIndex);
			String tempArr[] = tempString.split("_");
			for(int i=0;i<tempArr.length;i++){
				if(!tempArr[i].isEmpty()){
					parenthesisCnt++;
				}
			}

			s = s.replaceFirst("\\("+s.substring(startIndex+1,endIndex)+"\\)","_");
			startIndex = s.indexOf('(');
			endIndex = s.indexOf(')');
		}
		int cnt = 0;
		int max = 0;
		String tempArr2[] = s.split("_");
		for(int i=0;i<tempArr2.length;i++){
			if(!tempArr2[i].isEmpty()){
				cnt = tempArr2[i].length();
				if(cnt > max) max = cnt;
			}
		}
		System.out.println(max+" "+parenthesisCnt);
	}
}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class TextDoc {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		scan.nextLine();
		String s = scan.nextLine();
		String[] p = s.split("\\(.*?\\)");
		int max = 0;
		for(int i = 0; i < p.length; i++){
			StringTokenizer st = new StringTokenizer(p[i], "_");
			while(st.hasMoreTokens()){
				String b = st.nextToken();
				max = Math.max(b.length(), max);
			}
		}
		ArrayList<String> li = new ArrayList<String>();
		char a = '(';
		char b = ')';
		int last = -1;
		for(int i = 0; i < s.length(); i ++){
			char c = s.charAt(i);
			if(c == a){
				last = i;
			}
			if(c == b && last != -1){
				li.add(s.substring(last+1, i));
			}
		}
		int count = 0;
		for(int i = 0; i < li.size(); i++){
			String[] words = li.get(i).split("_");
			for(int j = 0; j < words.length; j++){
				if(words[j].length() > 0) count++;
			}
		}
		System.out.println(max+" "+count);
	}
}

import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n;
		String s;
		n = sc.nextInt();
		s = sc.next();
		boolean openParathensis = false ;
		StringBuilder sb = new StringBuilder();
		int maxOutSide = 0;
		int nbrInside = 0;
		for(int i = 0 ; i<n;i++){
			if(s.charAt(i) == '('){
				if(!openParathensis){
					String[] outsideWords = sb.toString().split("_");
					for(String o : outsideWords){
						maxOutSide = Math.max(maxOutSide,o.length());
					}
				}
				openParathensis = true;
				sb = new StringBuilder();
			}
			else if(s.charAt(i) == ')'){
				openParathensis = false;
				List<String> inside = Arrays.asList(sb.toString().split("_"));
				nbrInside+=inside.stream().filter(x -> !x.isEmpty()).count();
				sb = new StringBuilder();
			}else{
				sb.append(s.charAt(i));
			}
		}
		String[] outsideWords = sb.toString().split("_");
		for(String o : outsideWords){
			maxOutSide = Math.max(maxOutSide,o.length());
		}
		System.out.println(maxOutSide+" "+nbrInside);
	}
}

import java.util.*;
import java.math.*;
import java.io.*;
 public class Main{

    static FastReader scan=new FastReader();
   public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
 static int mod(int x,int y)
    {
        if(x<0)
            x=x+(-x/y+1)*y;
        return x%y;
    }
    static int A=400,n;
    static int l[]=new int[5050];
    static int r[]=new int[5050];
    static char c[]=new char[5050];
static int solve(int x){
	int a=0,b=0;
	for(int i=0;i<n;i++)
	{
		if(x<l[i]||x>r[i])
			continue;
		if(c[i]=='M')
			a++;
		else b++;
	}
	return Math.min(a,b);
}
public static void main(String[] args)  throws IOException
{
 n=scan.nextInt();
String s=scan.next();
int cur=0,c=0,a=0,b=0;
for(int i=0;i<n;i++){
	if(s.charAt(i)=='('||s.charAt(i)==')'||s.charAt(i)=='_'){
		if(c>0){
			if(cur>0)b++;
			else a=Math.max(c,a);
			c=0;
		}
		if(s.charAt(i)=='(')
			cur=1;
		if(s.charAt(i)==')')cur=0;
	}
	else c++;
}
a=Math.max(a,c);
out.println(a+" "+b);
out.close();
}

 public static  long pow(long b, long e) {
            long r = 1;
            while (e > 0) {
                if (e % 2 == 1) r = r * b ;
                b = b * b;
                e >>= 1;
            }
            return r;
        }
private static void sort(long[] arr) {
        List<Long> list = new ArrayList<>();
        for (long object : arr) list.add(object);
        Collections.sort(list);
        for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);
    }
 public static class FastReader {
        BufferedReader br;
        StringTokenizer root;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (root == null || !root.hasMoreTokens()) {
                try {
                    root = new StringTokenizer(br.readLine());
                } catch (Exception addd) {
                    addd.printStackTrace();
                }
            }
            return root.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (Exception addd) {
                addd.printStackTrace();
            }
            return str;
        }
         public int[] nextIntArray(int arraySize) {
            int array[] = new int[arraySize];

            for (int i = 0; i < arraySize; i++) {
                array[i] = nextInt();
            }

            return array;
        }
}
static class pair{
	int i;
	int j;
pair(int i,int j){
	this.i=i;
	this.j=j;
}

}}

import java.io.*;
import java.util.*;
public class div375Bn
{
	BufferedReader in;
	PrintWriter ob;
	StringTokenizer st;
	public static void main(String[] args) throws IOException {
		new div375Bn().run();
	}
	void run() throws IOException {
		in=new BufferedReader(new InputStreamReader(System.in));
		ob=new PrintWriter(System.out);
		solve();
		ob.flush();
	}
	void solve() throws IOException {
		int n=ni();
		char s[]=ns().toCharArray();
		int len=0;
		boolean inner=false;
		int ans1=0,ans2=0;
		for(char ch : s) {
			if(ch=='(') {
				ans1=Math.max(ans1,len);
				inner=true;
				len=0;
			}
			else if(ch==')') {
				if(inner){
					if(len>0)++ans2;
				}
				else
					ans1=Math.max(ans1,len);
				inner=false;
				len=0;
			}
			else if(ch=='_') {
				if(inner) {
					if(len>0)++ans2;
				}
				else
					ans1=Math.max(ans1,len);
				len=0;
			}
			else
				++len;
		}
		if(inner) {
			if(len>0)++ans2;
		}
		else
			ans1=Math.max(ans1,len);
		ob.println(ans1+" "+ans2);
	}
	String ns() throws IOException {
		return nextToken();
	}
	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}
	String nextToken() throws IOException {
		if(st==null || !st.hasMoreTokens())
			st=new StringTokenizer(in.readLine());
		return st.nextToken();
	}
}

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

/**
 * Oct 3, 2016 | 12:28:10 PM
 *

 * Description
 *
 *

 *
 * @author Essiennta Emmanuel (colourfulemmanuel@gmail.com)
 */
public class ProblemB {

    private void solve(char[] a, PrintWriter out) {
        int i = 0;
        int one = 0;
        int two = 0;
        boolean insideParenthesis = false;
        while (i != a.length) {
            if (a[i] == '(') {
                insideParenthesis = true;
            } else if (a[i] == ')') {
                insideParenthesis = false;
            } else if (Character.isLetter(a[i]))
                i--;
            if (insideParenthesis) { // inside
                while (++i != a.length && a[i] != ')' && !Character.isLetter(a[i]));
                if (i == a.length || !Character.isLetter(a[i])) {
                    continue;
                }
                while (Character.isLetter(a[++i]));
                two++;
            } else {
                while (++i != a.length && a[i] != '(' && !Character.isLetter(a[i]));
                if (i == a.length || !Character.isLetter(a[i])) {
                    continue;
                }

                int j = i;
                while (++i != a.length && Character.isLetter(a[i]));
                one = Math.max(one, i - j);
            }
        }
        out.println(one + " " + two);
    }

    public static void main(String[] args) throws IOException {
        try (BufferedReader in = new BufferedReader(new InputStreamReader(args.length == 0 ? System.in : new FileInputStream(args[0])));
                PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {
            in.readLine();
            new ProblemB().solve(in.readLine().toCharArray(), out);
        }
    }
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String a = sc.next();
		boolean paren=false;
		int max = 0;
		int cnt = 0;
		int temp=0;

		for(int i = 0 ;i < n;i++){
		 if(a.charAt(i)=='_'){
		   if(paren==true&&temp!=0){
		   	 cnt++;
		     temp = 0;
		   }else{

		   	if(temp>max)
		   	max = temp;
		    temp = 0;
		   }

		 }else if(a.charAt(i)=='('){
		   paren = true;
		   	if(temp>max)
		   	max = temp;
		  	temp =0;
		 }else if(a.charAt(i)==')'){
		   paren = false;
		   if(temp>0){
		   	cnt++;
		   	temp = 0;
		   }

		 }else{
		    temp++;
		 }

		}
		if(temp>max)
		   	max = temp;

		System.out.println(max+" "+cnt);

	}
}

//package com.turtle.bone;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class AK375 {
	public static Scanner cin = new Scanner(System.in);
	public String ak375(int n,String str){
		String[] arr=null;
		int i=0;
		int res1=0;
		int res2=0;
		StringBuffer tmpstr2 = new StringBuffer();
		StringBuffer tmpstr1 = new StringBuffer();

		for(i=0;i<n;i++){
			if(str.charAt(i)=='('){
				tmpstr2.append("_");
				while(str.charAt(i+1)!=')'){
//					System.out.println(str.charAt(i+1));
					tmpstr2.append(str.charAt(i+1));
					i++;
				}
			}else if(str.charAt(i)==')'){
				tmpstr1.append("_");
			}else{
				tmpstr1.append(str.charAt(i));
			}
		}
		String[] tmparrstr2=tmpstr2.toString().split("_");
		List arrstr2=new ArrayList();
		for(int k=0;k<tmparrstr2.length;k++){
			if(tmparrstr2[k]!=null && !tmparrstr2[k].equals("")){
				arrstr2.add(tmparrstr2[k]);
			}
		}
	//	System.out.println("tmpstr2:"+tmpstr2.toString());
		res2=arrstr2.size();
		String[] arrstr1=tmpstr1.toString().split("_");
	//	System.out.println("tmpstr1:"+tmpstr1.toString());
		for(int j=0;j<arrstr1.length;j++){
			if(arrstr1[j].length()>res1){
				res1=arrstr1[j].length();
			}
		}
		return res1+" "+res2;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		while (cin.hasNext()) {
			int n = cin.nextInt();
			String str = cin.next();
        long st=System.currentTimeMillis();
        String res=new AK375().ak375(n, str);
        long et=System.currentTimeMillis();
   //     System.out.println("time:"+(et-st));

        System.out.println(res);

		}
	}

}

import java.util.Scanner;

public class Words {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String str=sc.next();
		char[] ch=str.toCharArray();
		int[] temp=new int[n];
		int count=0;
		int k=0;
		for(int i=0;i<n;i++){
			temp[i]=0;
		}
		int flag = 0;
		if(ch[0]=='_'){
			flag=0;
		}
		else if(ch[0]=='('){
			flag=1;
		}
		for(int i=0;i<n;i++){
			if(flag==0){
				if(ch[i]=='_' ){
					k++;
				}
				else {
					if(ch[i]!='('){
						temp[k]++;
					}
					else if(ch[i]=='('){
						flag=1;

					}
					else if(ch[i]==')'){
						flag=0;
					}
				}
			}
			else{
				if(ch[i]==')'){
					flag=0;
					k++;
				}
				else if(i>0){
					 if(ch[i-1]=='('||ch[i-1]=='_'){
						 if( ch[i]!='_' && ch[i]!='('){
							 count++;
					 }

					}

				}

			}

		}

		int temp1;

		for(int i=0;i<n;i++){
			for(int j=i;j>0;j--){
				if(temp[j]>temp[j-1]){
					temp1=temp[j];
					temp[j]=temp[j-1];
					temp[j-1]=temp1;
				}
			}
		}
		System.out.println(temp[0]);
		System.out.println(count);
	}
}

    import java.util.Scanner;

    public class JavaApplication1 {

    public static void main(String[] args)
    {

        Scanner sc=new Scanner(System.in);
        String s,ss="";int i,flag=0,max=0;
        s=sc.nextLine();
        s=sc.nextLine();
        s=s.replaceAll("_+", " ").trim();
        for(i=0;i<s.length();i++)
        {
            if(s.charAt(i) == '(')
                flag=1;
            else if(s.charAt(i) == ')')
            {
                ss+=" ";
                flag=0;
            }
            else if(flag == 1)
                ss+=s.charAt(i);
        }
        for(i=0;i<s.length();i++)
            if(s.charAt(i) == ')')
            {
                s=s.substring(0,s.indexOf("("))+" "+s.substring(i+1);
                i=0;
            }
            else if(s.charAt(i) == ')' && i == s.length()-1)
            {
                s=s.substring(0,s.indexOf("("));
                i=0;
            }
        s=s.replaceAll(" +", " ").trim();
        ss=ss.replaceAll(" +"," ").trim();
        String []out=s.split(" ");
        String []in=ss.split(" ");
        for(i=0;i<out.length;i++)
        {
            if(out[i].length() > max)
                max=out[i].length();
        }
        if(!ss.equals("") && !ss.equals(" "))
            System.out.println(max+" "+in.length);
        else
            System.out.println(max+" "+"0");
    }
}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.StringTokenizer;

public class B {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st;
	static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

	static void solve() throws Exception {
		int n = nextInt();
		String s = next();
		int max = 0;
		int cur = 0;
		int count = 0;
		boolean open = false;
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			if (c == '_') {

				if (open) {
					if (cur > 0) {
						count++;
					}
				} else {
					max = Math.max(max, cur);
				}
				cur = 0;
			} else if (c == '(') {
				if (cur > 0) {
					max = Math.max(max, cur);
				}
				cur = 0;
				open = true;
			} else if (c == ')') {
				if (cur > 0) {
					count++;
				}
				open = false;
				cur = 0;
			} else {
				cur++;
			}
		}
		max = Math.max(cur, max);

		println(max + " " + count);

	}

	private static void print(String s) throws IOException {
		out.write(s);
	}

	private static void println(String s) throws IOException {
		print(s);
		out.newLine();
	}

	private static void println() throws IOException {
		out.newLine();
	}

	public static void main(String[] args) throws Exception {
		solve();
		out.close();
	}

	static String next() throws Exception {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(br.readLine());
		}
		return st.nextToken();
	}

	static int nextInt() throws Exception {
		return Integer.parseInt(next());
	}

	static long nextLong() throws Exception {
		return Long.parseLong(next());
	}
}

import java.util.Scanner;

public class CodeForces
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		scan.next();
		char[] s = scan.next().toCharArray();
		boolean in = false;
		int len = 0, maxLen = 0, words = 0;
		for (int i = 0; i < s.length; i++)
		{
			if ('a' <= s[i] && s[i] <= 'z' || 'A' <= s[i] && s[i] <= 'Z')
				len++;
			else
				len = 0;
			if (s[i] == '(')
				in = true;
			else if (s[i] == ')')
				in = false;
			if (in)
			{
				if (len == 1)
					words++;
			}
			else
				maxLen = Math.max(len, maxLen);
		}
		System.out.println(maxLen + " " + words);
	}
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        int n = Reader.nextInt() ;
        String s = Reader.next().replaceAll("_+"," ") ;
        StringBuilder fuck = new StringBuilder() ;
        for (int i=0 ; i<s.length() ; i++) {
            if (s.charAt(i)=='(') {
                fuck.append(" ( ");
            }else if (s.charAt(i)==')') {
                fuck.append(" ) ");
            } else {
                fuck.append(s.charAt(i));
            }
        }
        s = fuck+"" ;
        String [] a = s.split(" +");
        boolean is = false ;
        int max = 0 , c = 0;
        for (int i=0 ; i<a.length ; i++) {
            if (a[i].contains("(")) {
                is = true;
            } else if (a[i].contains(")")) {
                is = false ;
            } else if (a[i].contains(")")==false && a[i].contains("(")==false){
                if (is){
                    c ++ ;
                } else {
                    max = Math.max(a[i].length(),max);
                }

            }
        }
        System.out.println(max + " "+ c);

    }

}
class Pair {
    int x ;
    int y ;

    Pair (int x , int y) {
        this.x = x ;
        this.y = y ;
    }
}
class Reader {

        static BufferedReader reader;
        static StringTokenizer tokenizer;

        public static int pars(String x) {
            int num = 0;
            int i = 0;
            if (x.charAt(0) == '-') {
                i = 1;
            }
            for (; i < x.length(); i++) {
                num = num * 10 + (x.charAt(i) - '0');
            }

            if (x.charAt(0) == '-') {
                return -num;
            }

            return num;
        }

        static void init(InputStream input) {
            reader = new BufferedReader(
                    new InputStreamReader(input));
            tokenizer = new StringTokenizer("");
        }

        static void init(FileReader input) {
            reader = new BufferedReader(input);
            tokenizer = new StringTokenizer("");
        }

        static String next() throws IOException {
            while (!tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(
                        reader.readLine());
            }
            return tokenizer.nextToken();
        }

        static int nextInt() throws IOException {
            return pars(next());
        }

        static long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        static double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }

import java.util.Scanner;

public class Prepare {

	public static void main(String[] args) {
		Scanner sc  = new Scanner(System.in);
		int a;
		a = sc.nextInt();
		String in = sc.next();
		int len = 0;
		int tmp = 0;
		int count = 0;
		boolean bl = false;
		boolean prev = false;
		for(int i = 0; i < in.length(); i++){
			if( ((96 < in.charAt(i) - 0) && (in.charAt(i) < 123)) || (in.charAt(i) > 64 && in.charAt(i) < 91)){
			if(bl && !prev)
				count++;
			if(!bl)
			len++;
			if(len > tmp)
				tmp = len;
			prev = true;
			}

			else if(in.charAt(i) == '_'){
				prev = false;
				if(len > tmp)
				tmp = len;
				len = 0;
				}

			else if(in.charAt(i) == '('){
				prev = false;
				bl = true;
				if(len > tmp)
					tmp = len;
				len = 0;
			}
			else if(in.charAt(i) == ')'){
				bl = false;
				prev = false;
				if(len > tmp)
					tmp = len;
				len = 0;
			}
		}
		System.out.println(tmp+" "+count);
	sc.close();
	}

}

import java.util.*;
public class B723 {
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		String s=sc.next();
		int sum=0;
		int tmp=0;
		int su=0;
		String temp="";
		for(int i=0;i<a;i++)
		{
			if(s.charAt(i)=='(')
			{
				i++;
				if(tmp>sum)
					sum=tmp;
				tmp=0;
				while(s.charAt(i)!=')')
				{
					temp=temp+s.charAt(i);
					i++;
				}
				StringTokenizer st=new StringTokenizer(temp,"_");
				su=su+st.countTokens();
				temp="";
			}
			else if(s.charAt(i)=='_')
			{
				if(tmp>sum)
					sum=tmp;
				tmp=0;
			}
			else
			{
				tmp++;
			}
		}
		if(tmp>sum)
			sum=tmp;
		StringTokenizer st1=new StringTokenizer(temp,"_");
		su=su+st1.countTokens();
		System.out.println(sum+" "+su);
		sc.close();
	}
}

import java.util.*;
import java.io.*;
import java.math.*;

public class Main
{
    public static void process()throws IOException
    {
        int n = ni(), words_inside_brackets = 0, longest_word_outside = 0, len = 0;
        char arr[] = (" "+nln()+" ").toCharArray();

        boolean inside_brackets = false;

        for(int i = 1; i <= n; i++){
            if(arr[i] ==  '('){
                inside_brackets = true;
                continue;
            }

            if(arr[i] == ')'){
                inside_brackets = false;
                continue;
            }

            if(arr[i] == '_'){
                while(arr[i+1] == '_')
                    i++;
                continue;
            }

            len = 1;
            while(i+1 <= n && Character.isLetter(arr[i+1])){
                i++;
                len++;
            }

            if(inside_brackets)
                words_inside_brackets++;
            else
                longest_word_outside = Math.max(longest_word_outside,
                                            len);
        }

        pn(longest_word_outside+" "+words_inside_brackets);
    }

    static final long mod=(long)1e9+7l;

    static FastReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc=new FastReader();

        long s = System.currentTimeMillis();
        int t=1;
        //t=ni();
        while(t-->0)
            process();

        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static int ni()throws IOException{return Integer.parseInt(sc.next());}
    static long nl()throws IOException{return Long.parseLong(sc.next());}
    static double nd()throws IOException{return Double.parseDouble(sc.next());}
    static String nln()throws IOException{return sc.nextLine();}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}

    static class FastReader{
        BufferedReader br;
        StringTokenizer st;

        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next(){
            while (st == null || !st.hasMoreElements()){
                try{ st = new StringTokenizer(br.readLine()); } catch (IOException  e){ e.printStackTrace(); }
            }
            return st.nextToken();
        }

        String nextLine(){
            String str = "";
            try{ str = br.readLine(); } catch (IOException e) { e.printStackTrace(); }
            return str;
        }
    }
}

/**
 * Created by My PC on 03/10/2016.
 */

import java.util.*;

public class P2 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int length = input.nextInt();
        input.nextLine();
        String str = input.nextLine();

        int maxLength = 0;
        int countLength = 0;
        int countWord = 0;
        int checker = 0;
        int checkerInside = 0;
        boolean isInWordOut = false;
        boolean isInWordIn = false;
        boolean isInside = false;

        int index = 0;

        while (index < length)
        {
            if (str.charAt(index) == '(')
            {
                isInside = true;
                checkerInside++;
                if (maxLength < countLength)
                    maxLength = countLength;
                countLength = 0;
                isInWordOut = false;
            }
            else if (str.charAt(index) == ')')
            {
                isInside = false;
                checkerInside = 0;
                if (checker > 0)
                {
                    countWord++;
                    checker = 0;
                }
            }
            else
            {
                if (checkerInside > 0)
                {
                    isInside = true;
                }
            }

            if (index == length)
                break;

            if (str.charAt(index) != ')' & str.charAt(index) != '(')
            {
                if (!isInside)
                {
                    if (str.charAt(index) == '_')
                    {
                        if (maxLength < countLength)
                            maxLength = countLength;
                        countLength = 0;
                        isInWordOut = false;
                    }
                    else isInWordOut = true;

                    if (isInWordOut)
                    {
                        countLength++;
                    }
                }
                else
                {
                    isInWordOut = false;
                    if (str.charAt(index) == '_')
                    {
                        if (checker > 0)
                            countWord++;
                        checker = 0;
                        isInWordIn = false;
                    }
                    else isInWordIn = true;

                    if(isInWordIn)
                    {
                        checker++;
                    }
                }
            }

            index++;
        }

        if (maxLength < countLength)
            maxLength = countLength;

        System.out.println(maxLength + " " + countWord);

    }
}

import java.util.*;
import java.io.*;
public class Text_Document_Analysis
{
	public static void main(String args[]) throws Exception
	{
		BufferedReader f=new BufferedReader(new InputStreamReader(System.in));
		// BufferedReader f=new BufferedReader(new FileReader("Text_Document_Analysis.in"));
		f.readLine();
		String temp=f.readLine();
		String[] arr1=temp.split("\\([a-zA-Z_]*\\)");
		int one=0;
		for(int x=0;x<arr1.length;x++)
		{
			String[] temparr=arr1[x].split("_+");
			for(int y=0;y<temparr.length;y++)
				one=Math.max(one,temparr[y].length());
		}
		int pos=0;
		int two=0;
		boolean flag=false;
		boolean flag1=false;
		for(int x=0;x<temp.length();x++)
		{
			if(temp.charAt(x)=='(')
				flag=true;
			if(temp.charAt(x)==')')
			{
				flag1=false;
				flag=false;
			}
			if(flag&&temp.substring(x,x+1).matches("[a-zA-Z]"))
			{
				if(flag1) continue;
				two++;
				flag1=true;
			}
			if(temp.substring(x,x+1).matches("_"))
				flag1=false;
		}
		System.out.println(one+" "+two);
	}
}

import java.util.Scanner;
import java.util.regex.MatchResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class CF_723B {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();

		String regex = "\\([a-zA-Z_]*\\)";
		Pattern pat = Pattern.compile(regex);
		Matcher mat = pat.matcher(s);

		String newString = mat.replaceAll("_");

		String[] left = newString.split("_+");
		int maxLength = 0;
		for(int i = 0;i<left.length;i++){
			maxLength = Math.max(maxLength,left[i].length());
		}

		System.out.println(maxLength);
		int count = 0;
		boolean isStart = false;
		int startIndex = -1;
		int endIndex = -1;
		for(int i = 0;i<s.length();i++){
			char c = s.charAt(i);
			if(c == '('){
				isStart = true;
				startIndex = i;
				continue;
			}
			if(isStart){
				if(c == ')'){
					isStart = false;
					endIndex = i;
					String tmp = s.substring(startIndex+1,endIndex);
					if(tmp.equals(""))
						continue;
					if(tmp.startsWith("_")){
						String[] tmps = tmp.split("_+");
						if(tmps.length!=0)
							count+=(tmps.length-1);
						else
							count+=tmps.length;
					}else{
						String[] tmps = tmp.split("_+");
						count+=tmps.length;
					}

				}
			}
		}
		System.out.println(count);
	}
}

import java.util.Scanner;
import java.io.*;
import java.util.*;
import java.math.*;

public class Check2
{
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

		short nextShort()
        {
            return Short.parseShort(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

	public static void main(String args[])
	{
		FastReader sc =new FastReader();
		int n=sc.nextInt();

		String ip=sc.next();
		char c[]=ip.toCharArray();
		int max=0;
		int max1=0;
		int flag=0;
		int count=0;
		int flag1=0;
		for(int i=0;i<c.length;i++)
		{
			//int count=0;
			if((c[i]>=65 && c[i]<=90)||(c[i]>=97 && c[i]<=122))
			{
				count++;
			}
			else if(c[i]=='_' && flag==0)
			{
				if(count>max)
					max=count;
				count=0;
			}
			else if(c[i]=='(' && flag==0)
			{
				if(count>max)
					max=count;
				count=0;
				flag1=0;
				int diff=0;
				while(c[i]!=')' && i<c.length)
				{
					diff++;
					if((c[i]>=65 && c[i]<=90)||(c[i]>=97 && c[i]<=122))
					{
						if(c[i+1]=='_')
						{
							max1++;
						}
					}
					i++;
				}
				if(c[i-1]!='_' && diff>1)
					max1++;
			}
		}

		if(count>max)
			max=count;
		System.out.print(max+" "+max1);
	}
}

 /*class a implements Comparable<a>
	{
		int val;
		String name;
		a(int val,String name)
		{
			this.val=val;
			this.name=name;
		}

		public int compareTo(a a1)
		{
			if(val==a1.val)
			{
				//if(name.length()==a1.name.length())
					return name.compareTo(a1.name);
				//else
					//return name.length()<a1.name.length()?-1:1;
			}
			else if(val<a1.val)
			return 1;
			else
			return -1;
		}

	}  */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class B {
	static int in=0;
	static int out=0;
	public static void main(String[] args) throws IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int l=Integer.parseInt(br.readLine());
		String line=br.readLine();
		 //loop and whebn paranthesis substring
		 String sub="";
		for(int i=0;i<l;i++){

			if(line.charAt(i)=='(')
			{   check(false,sub);
			    sub="";
				int oldi=i;
			   while(line.charAt(i)!=')'){
				      i++;

			 }
			   check(true,line.substring(oldi+1,i));

			}
			else {sub=sub+line.charAt(i);
			if(i==l-1)
				 check(false,sub);
			}
		}
		System.out.println(out+" "+in);

	}
	public static void check(boolean inside,String s ){

		if(inside){
			//System.out.println("in"+s);
			String [] arr=s.split("_");
			//System.out.println("inside"+Arrays.toString(arr));
			for(int i=0;i<arr.length;i++)
			{
				if(arr[i].length()>0)
					in++;
			}

		}
		else {
			//System.out.println("out"+s);
			int max=0;
			String [] arr=s.split("_");
			//System.out.println("outside"+Arrays.toString(arr));

			for(int i=0;i<arr.length;i++){
				if(arr[i].length()>max)
					max=arr[i].length();
			}

			if(max>out)
				out=max;
		}
	}

}

import java.util.*;
import java.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;
	PrintWriter out;

	private String next() throws Exception{
		while (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		int n = nextInt();
		char []a = next().toCharArray();
		// int n = a.length;

		int count = 0;
		for(int i = 0; i < n; ++i) {
			if (a[i] == '(') {
				int j = i + 1;
				while(j < n && a[j] != ')') ++j;
				count += count(i + 1, j - 1, a);
			}
		}

		int max = 0;
		int l = 0;
		for(int i = 0; i < n; ++i) {
			if (a[i] == '(') {
				max = Math.max(max, max(l, i - 1, a));
				int j = i;
				while(j < n && a[j] != ')') ++j;
				l = j + 1;
			}
		}
		if (l != n) {
			max = Math.max(max, max(l, n - 1, a));
		}

		out.println(max + " " + count);
		out.close();
	}

	private int count(int l, int r, char []a) {
		int ret = 0, c = 0;
		for(int i = l; i <= r; ++i) {
			if (a[i] == '_') {
				if (c > 0) ++ret;
				c = 0;
			} else {
				++c;
			}
		}
		if (c > 0) ++ret;
		return ret;
	}

	private int max(int l, int r, char []a) {
		int ret = 0, c = 0;
		for(int i = l; i <= r; ++i) {
			if (a[i] == '_') {
				ret = Math.max(ret, c);
				c = 0;
			} else {
				++c;
			}
		}
		ret = Math.max(ret, c);
		return ret;
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}

/*
 * PDPM IIITDM Jabalpur
 * Asutosh Rana
 */

import java.util.*;
import java.io.*;
import java.math.*;

public class Main
{
    long MOD = 1000000007;
    InputReader in;BufferedReader br;PrintWriter out;
    public static void main (String[] args) throws java.lang.Exception
    {
        Main solver = new Main();
        solver.in = new InputReader(System.in);
        solver.br = new BufferedReader(new InputStreamReader(System.in));
        solver.out = new PrintWriter(System.out);
        solver.solve();
        solver.out.flush();
        solver.out.close();
    }

    public void solve(){
        int tc = 1;//in.readInt();

        for(int cas=1;cas<=tc;cas++){
            int N = in.readInt();
            String Str = in.readString();
            char[] S = Str.toCharArray();

            int count = 0, par =0;
            int wordInPar = 0, max_length = 0;
            for(int i=0;i<S.length;i++){
                if(S[i]=='_'){
                    if(par==0){
                        max_length = Math.max(max_length, count);
                    }
                    else if(count>0){
                        wordInPar++;
                    }
                    count=0;
                }
                else if(S[i]=='('){
                    par=1;
                    max_length = Math.max(max_length, count);
                    count=0;
                }
                else if(S[i]==')'){
                    par=0;
                    if(count>0){
                        wordInPar++;
                    }
                    count=0;
                }
                else{
                    count++;
                }
                if(par==0){
                    max_length = Math.max(max_length, count);
                }
            }

            out.println(max_length+" "+wordInPar);
        }

    }

}

class InputReader{
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream){this.stream = stream;}
    public int read(){
        if (numChars==-1) throw new InputMismatchException();
        if (curChar >= numChars){
            curChar = 0;
            try {numChars = stream.read(buf);}
            catch (IOException e){throw new InputMismatchException();}
            if(numChars <= 0) return -1;
        }
        return buf[curChar++];
    }

    public int readInt(){
        int c = read();
        while(isSpaceChar(c)) c = read();
        int sgn = 1;
        if (c == '-') {sgn = -1;c = read();}
        int res = 0;
        do {
            if(c<'0'||c>'9') throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        }
        while (!isSpaceChar(c)); return res * sgn;
    }

    public void readInt(int[] A){
        for(int i=0;i<A.length;i++)
            A[i] = readInt();
    }

    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        }
        while (!isSpaceChar(c));
        return res * sgn;
    }

    public void readLong(long[] A){
        for(int i=0;i<A.length;i++)
            A[i] = readLong();
    }

    public double readDouble() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        double res = 0;
        while (!isSpaceChar(c) && c != '.') {
            if (c == 'e' || c == 'E')
                return res * Math.pow(10, readInt());
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpaceChar(c)) {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                m /= 10;
                res += (c - '0') * m;
                c = read();
            }
        }
        return res * sgn;
    }

    public char[] readCharA(){
        return readString().toCharArray();
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public String next() {
        return readString();
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }

}

import java.io.*;
import java.util.*;
import java.util.stream.*;
import java.util.regex.*;
//Arrays.stream(br.readLine().split("\\s")).mapToInt(Integer::parseInt).toArray();

public class solution{

    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static PrintWriter pw = new PrintWriter(System.out);

public static void main(String[] args) throws IOException {
        br.readLine();
        String s = br.readLine();
        String g = "\\([a-zA-z_]*\\)";
        String[] outsides = s.replaceAll(g, "_").split("_+");
        int longest = 0, length;
        for (String outside : outsides) {
            length = outside.length();
            if (length > longest) {
                longest = length;
            }
        }

        Pattern p = Pattern.compile(g);
        Matcher m = p.matcher(s);
        int words = 0;
        String group, aux;
        while (m.find()) {
            group = m.group();
            aux = group.replaceFirst("\\(_*", "");
            aux = aux.replaceFirst("_*\\)", "");
            if (aux.length() > 0) {
                words += aux.split("_+").length;
            }
        }

        pw.println(longest+" "+words);
        br.close();
        pw.flush();
        pw.close();
    }

}//class

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String a = sc.next();
		boolean paren=false;
		int max = 0;
		int cnt = 0;
		int temp=0;

		for(int i = 0 ;i < n;i++){
		 if(a.charAt(i)=='_'){
		   if(paren==true&&temp!=0){
		   	 cnt++;
		     temp = 0;
		   }else{

		   	if(temp>max)
		   	max = temp;
		    temp = 0;
		   }

		 }else if(a.charAt(i)=='('){
		   paren = true;
		   	if(temp>max)
		   	max = temp;
		  	temp =0;
		 }else if(a.charAt(i)==')'){
		   paren = false;
		   if(temp>0){
		   	cnt++;
		   	temp = 0;
		   }

		 }else{
		    temp++;
		 }

		}
		if(temp>max)
		   	max = temp;

		System.out.println(max+" "+cnt);

	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created by Irina on 03.10.2016.
 */
public class Solution {

    static int[] count_in(int i, String s){
        int c[] = new int[2];
        c[0] = 0;
        int tmp = 0;

        OUT: for ( int j = i; j < s.length(); j++) {
            if(s.charAt(j) == 41){
                c[1] = j+1;
                break OUT;
            }
            if(s.charAt(j) != 95){
                c[0]++;
                while(s.charAt(j) != 95){
                    if(s.charAt(j) == 41){
                        c[1] = j+1;
                        break OUT;
                    }
                    j++;
                }
            }
        }

        return c;
    }

    public static void main(String[] args) throws IOException{

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String s = br.readLine();
        int max = 0;
        int count = 0;
        int i = 0;
        int tmp = 0;
        int a[] = new int[2];
        while(i < n && s.charAt(i) == 95){
            i++;
        }
        for (int j = i; j < n; j++) {
            if(s.charAt(j) == 40){
                max = Math.max(max, tmp);
                tmp = 0;
                a = count_in(j+1, s);
                count += a[0];
                j = a[1]-1;
                if (j >= n){
                    break;
                }
            }else {
                if (s.charAt(j) == 95) {
                    max = Math.max(max, tmp);
                    tmp = 0;
                }
                if (s.charAt(j) != 95 && s.charAt(j) != 40 && s.charAt(j) != 41) {
                    tmp++;
                }
            }
        }

        max = Math.max(max, tmp);

        System.out.println(max + " " + count);

    }
}

import java.util.Scanner;

public class Test {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    while (s.hasNextLine()) {
      s.nextLine();
      System.out.println(TextDocumentAnalysis.input(s.nextLine()));
    }
    s.close();
  }
  public static void main0(String[] args) {
    String[] ins = {
      "_Hello_Vasya(and_Petya)__bye_(and_OK)",
      "_a_(_b___c)__de_f(g_)__h__i(j_k_l)m__",
      "(LoooonG)__shOrt__(LoooonG)",
      "(___)",
      "Q(___)_u(_U)HG"
    };
    for (int i=0; i<ins.length; i++) {
      String s = TextDocumentAnalysis.input(ins[i]);
      System.out.println(s);
    }
  }
}

class TextDocumentAnalysis {
  public static String input(String str) {
    int len = str.length();
    boolean open = false;
    int wc = 0;
    int max = 0;
    int wlen = 0;
    for (int i=0; i<len; i++) {
      char ch = str.charAt(i);
      if (ch == '(') {
        if (wlen > 0) {
          if (wlen > max) max = wlen;
          wlen = 0;
        }
        open = true;
      } else if (ch == ')') {
        if (wlen > 0) {
          wc++;
          wlen = 0;
        }
        open = false;
      } else if (ch == '_') {
        if (wlen > 0) {
          if (open) {
            wc++;
          } else {
            if (wlen > max) max = wlen;
          }
          wlen = 0;
        }
      } else {
        wlen++;
      }
    }
    if (wlen > 0) {
      if (open) {
        wc++;
      } else {
        if (wlen > max) max = wlen;
      }
    }
    return max + " " + wc;
  }
}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner S=new Scanner(System.in);
		int n=S.nextInt();
		String str=S.next();
		int max_len=0,a2=0;
		int b=0,u=0;
		String wd="";
		for(int i=0;i<str.length();i++)
		{
		    char ch=str.charAt(i);
		    if(ch=='_') {u=1^u;wd="";continue;}
		    if(ch=='(') {b=1;wd="";continue;}
		    if(ch==')') {b=0;wd="";continue;}
		    wd=wd+ch;
		    if(wd.length()>max_len && b==0) max_len=wd.length();
		    if(i!=n-1 && (str.charAt(i+1)=='_' || str.charAt(i+1)==')'))
		    {
		        if(b==1) a2++;
		        //if(wd.length()>max_len) max_len=wd.length();
		    }
		}
		System.out.println(max_len+" "+a2);
	}
}

/*
 * CODRE: ATIKUR RAHMAN
 * DATE: 29/10/2016
 *
 * */

import java.util.Scanner;

public class P_B_Text_Document_Analysis {
	static int outMax, inMax, count = 0;

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int stringLen = scanner.nextInt();

		String text = scanner.next();

		scanner.close();
		int i = 0;

		try {
			while (true) {

				if (text.charAt(i) == '(') {
					while (true) {
						int c=0;
							while (text.charAt(i) != '_' && text.charAt(i)!=')' && text.charAt(i)!='(') {
								if (c==0) {
									inMax++;
									c++;
								}
								i++;
							}

						if (text.charAt(i)==')') {
							count=0;
							break;

						}
						count=0;
						i++;
					}
				} else {
					while (true) {

							while (text.charAt(i) != '_' && text.charAt(i)!=')' && text.charAt(i)!='(') {
								count++;
								i++;
							}

						if (outMax < count) {
							outMax = count;
							count = 0;
						}

						if (text.charAt(i)=='(') {
							count=0;
							break;
						}
						count=0;
						i++;
					}
				}
			}
		} catch (Exception e) {

		}finally{
			if (outMax < count) {
				outMax = count;
			}
		}

		System.out.print(outMax + " " + inMax);

	}

}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int len = in.nextInt();
            in.nextLine();
            char[] file = in.next().toCharArray();
            if (file[0] != '_' && file[0] != '(')
                file = ("_" + new String(file)).toCharArray();
            if (file[file.length - 1] != '_' && file[file.length - 1] != ')')
                file = (new String(file) + "_").toCharArray();
            int max = 0, inparan = 0;
            int cnt = 0;
            for (int i = 0; i < file.length; i++) {
                if (file[i] == '(') {
                    max = Math.max(cnt, max);
                    cnt = 0;
                    while (file[i] != ')') {
                        i++;
                    }
                    continue;
                }
                if (file[i] == '_') {
                    max = Math.max(cnt, max);
                    cnt = 0;
                } else {
                    cnt++;
                }
            }
            for (int i = 1; i < file.length; i++) {
                if (file[i - 1] == '(') {
                    while (file[i] != ')') {
                        if (file[i] == '_' && (file[i - 1] != '(' && file[i - 1] != '_')) {
                            inparan++;
                        }
                        i++;
                    }
                    if (file[i - 1] != '(' && file[i - 1] != '_') {
                        inparan++;
                    }
                }
            }
            out.write(Integer.toString(max) + " " + Integer.toString(inparan));
        }

    }
}

import java.io.*;
import java.util.*;

public class Main {
	static int mod = (int) (1e9+7);
	static InputReader in;
    static PrintWriter out;

		public static void main(String args[] )  {

			in = new InputReader(System.in);
	        out = new PrintWriter(System.out);
	        Scanner in = new Scanner (System.in);
	       int n = in.nextInt();
	      in.nextLine();
	      String s = in.next();
	      String x="";
	      int max=0;
	      int f=0;
	      int c=0;
	   /*   if(s.charAt(0)=='(') {
	    	  	f=1;
	      }
	      if(s.charAt(0)!='_' && s.charAt(0)!='(' && s.charAt(0)!=')') {
	    	  	x+=s.charAt(0);
	      }
	      */
	       for(int i=0;i<n;i++) {
	    	   	if(s.charAt(i)=='_') {

	    	   		if( x.length()!=0 && x.length()>max && f==0) {
	    	   			max=x.length();
	    	   			//System.out.println(x);
	    	   		}
	    	   		if(f==1 && x.length()!=0) {
	    	   			c++;
	    	   		}
	    	   		x="";
	    	   	}
	    	   	else if(s.charAt(i)=='(') {

	    	   		if(x.length()>max && f==0) {
	    	   			max=x.length();
	    	   			//System.out.println(x);
	    	   		}
	    	   		f=1;
	    	   		x="";
	    	   	}
	    	   	else if(s.charAt(i)==')') {
	    	   		if(x.length()!=0) {
	    	   		c++;
	    	   		}
	    	   		f=0;
	    	   		x="";
	    	   	}
	    	   	else {
	    	   		x+=s.charAt(i);
	    	   	}

	       }
	      if(x.length()>max) {
	    	   max=x.length();
	       }
	       System.out.print(max+" "+c);
	    	   in.close();

	        out.close();
		}

		static class InputReader
	    {

	        private final InputStream stream;
	        private final byte[] buf = new byte[8192];
	        private int curChar, snumChars;
	        private SpaceCharFilter filter;

	        public InputReader(InputStream stream)
	        {
	                this.stream = stream;
	        }

	        public int snext()
	        {
	                if (snumChars == -1)
	                        throw new InputMismatchException();
	                if (curChar >= snumChars)
	                {
	                        curChar = 0;
	                        try
	                        {
	                                snumChars = stream.read(buf);
	                        } catch (IOException e)
	                        {
	                                throw new InputMismatchException();
	                        }
	                        if (snumChars <= 0)
	                                return -1;
	                }
	                return buf[curChar++];
	        }

	        public int nextInt()
	        {
	                int c = snext();
	                while (isSpaceChar(c))
	                {
	                        c = snext();
	                }
	                int sgn = 1;
	                if (c == '-')
	                {
	                        sgn = -1;
	                        c = snext();
	                }
	                int res = 0;
	                do
	                {
	                        if (c < '0' || c > '9')
	                                throw new InputMismatchException();
	                        res *= 10;
	                        res += c - '0';
	                        c = snext();
	                } while (!isSpaceChar(c));
	                return res * sgn;
	        }

	        public long nextLong()
	        {
	                int c = snext();
	                while (isSpaceChar(c))
	                {
	                        c = snext();
	                }
	                int sgn = 1;
	                if (c == '-')
	                {
	                        sgn = -1;
	                        c = snext();
	                }
	                long res = 0;
	                do
	                {
	                        if (c < '0' || c > '9')
	                                throw new InputMismatchException();
	                        res *= 10;
	                        res += c - '0';
	                        c = snext();
	                } while (!isSpaceChar(c));
	                return res * sgn;
	        }

	        public int[] nextIntArray(int n)
	        {
	                int a[] = new int[n];
	                for (int i = 0; i < n; i++)
	                {
	                        a[i] = nextInt();
	                }
	                return a;
	        }

	        public long[] nextLongArray(int n)
	        {
	                long a[] = new long[n];
	                for (int i = 0; i < n; i++)
	                {
	                        a[i] = nextLong();
	                }
	                return a;
	        }

	        public String readString()
	        {
	                int c = snext();
	                while (isSpaceChar(c))
	                {
	                        c = snext();
	                }
	                StringBuilder res = new StringBuilder();
	                do
	                {
	                        res.appendCodePoint(c);
	                        c = snext();
	                } while (!isSpaceChar(c));
	                return res.toString();
	        }

	        public String nextLine()
	        {
	                int c = snext();
	                while (isSpaceChar(c))
	                        c = snext();
	                StringBuilder res = new StringBuilder();
	                do
	                {
	                        res.appendCodePoint(c);
	                        c = snext();
	                } while (!isEndOfLine(c));
	                return res.toString();
	        }

	        public boolean isSpaceChar(int c)
	        {
	                if (filter != null)
	                        return filter.isSpaceChar(c);
	                return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	        }

	        private boolean isEndOfLine(int c)
	        {
	                return c == '\n' || c == '\r' || c == -1;
	        }

	        public interface SpaceCharFilter
	        {
	                public boolean isSpaceChar(int ch);
	        }

	    }
}

//package MyPackage.YourPack.kfjf;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.StringTokenizer;

public class splitITup {

    public  static  void main(String []args){
//37
//_Hello_Vasya(and_Petya)__bye_(and_OK)
        List<Integer> parentStart=new ArrayList<Integer>();
        List<Integer> parentEnd=new ArrayList<Integer>();

        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        String target=scan.next();
     for(int i=0;i<n;i++){
         if(target.charAt(i)=='(')
             parentStart.add(i);
         if(target.charAt(i)==')')
             parentEnd.add(i);

     }

     int count=0;
     for(int i=0;i<parentEnd.size();i++)
     {
         String s=target.substring(parentStart.get(i)+1,parentEnd.get(i));
        // System.out.print(s+" ");
         String ss[]=s.split("_");

       for(String f:ss)// System.out.print("#"+f+"#");

          if(!f.equals("")) count++;
     }

      //  System.out.println(count);
     int Max=0;
        parentEnd.add(0,0);
        parentStart.add(target.length());
       /* for (int i:parentStart)
          System.out.println(i);
        for (int i:parentEnd)
            System.out.println(i);

        */

        int i;
        if(target.charAt(0)=='(')
            i=1;
        else {

            i=0;
        }

     for(;i<parentEnd.size();i++){
         String s;
if(target.charAt(parentEnd.get(i))==')')
            s =target.substring(parentEnd.get(i)+1,parentStart.get(i));
else  s =target.substring(parentEnd.get(i),parentStart.get(i));
             String ss[]=s.split("_");
             for(String sss:ss){
                // System.out.println(sss);
                 if(sss.length()>Max&&!sss.contains("(")&&!sss.contains(")")){
                     Max=sss.length();
                 }
             }

     }
        System.out.println(Max+" "+count);

    }
}

import java.util.Scanner;

public class Main10 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int am = scanner.nextInt();
        String zad = scanner.next();
        String s = zad;
        String skobki = "_";
        int str = -1;
        int len = s.length();

        for (int i = 0; i < len; i++) {
            char c = s.charAt(i);
            if (s.charAt(i) == '(') str = i;
            if (s.charAt(i) == ')') {
                skobki = skobki +"" + s.subSequence(str+1, i) + "_";
                s =  "" + s.subSequence(0, str) +"_"+ s.subSequence(i+1, s.length());
                len = s.length();
                i = str-1;
                str = -1;
            }
        }
        String arr [] = skobki.split("_");
        int count = 0;

        for (int i = 0; i < arr.length; i++)
            if (!arr[i].equals("")) count++;
         arr  = s.split("_");
        int max = 0;
        for (int i = 0; i < arr.length; i++)
            if (arr[i].length() > max) max = arr[i].length();
        System.out.println(max + " " + count);

    }
}

import java.util.ArrayList;
import java.util.Scanner;
import java.util.StringTokenizer;

/**
 * Created by sanjayarvind on 08/02/2017 AD.
 */
public class CR294B {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s=sc.next();
        int i=0,cnt=0,max=0,k=0;
        ArrayList<String> inside=new ArrayList<>();
        for(i=0;i<n;i++){
            if (s.charAt(i)=='('){
                String temp="";
                for(k=i+1;s.charAt(k)!=')';k++)
                    temp+=s.charAt(k);
                inside.add(temp);
                i=k;
            }
        }
        for (int j = 0; j < inside.size(); j++) {
            String s1 = inside.get(j);
            s=s.replaceAll("\\("+s1+"\\)","_");
        }
        StringTokenizer st=new StringTokenizer(s,"_()");
        while (st.hasMoreTokens()) {
            String t=st.nextToken();
            max = Math.max(max, t.length());
        }
        System.out.print(max);
        for (int j = 0; j < inside.size(); j++) {
            String s1 = inside.get(j);
            st=new StringTokenizer(s1,"_");
            cnt+=st.countTokens();
        }
        System.out.println(" "+cnt);
    }
}

import java.io.*;
import java.util.*;
public class div375B
{
	BufferedReader in;
	PrintWriter ob;
	StringTokenizer st;
	public static void main(String[] args) throws IOException {
		new div375B().run();
	}
	void run() throws IOException {
		in=new BufferedReader(new InputStreamReader(System.in));
		ob=new PrintWriter(System.out);
		solve();
		ob.flush();
	}
	void solve() throws IOException {
		int n=ni();
		char s[]=ns().toCharArray();
		int ans1=0,ans2=0;
		for(int i=0;i<n;i++) {
			for (int j=i+1; j<n ; j++ ) {
				if(s[j]==')'){i=j;break;}
				if(s[i]=='_' && (s[j]=='_' || s[j]=='('))
					{ans1=Math.max(ans1,j-i-1);i=j-1;break;}
				if(s[i]==')' && s[j]=='_')
					{ans1=Math.max(ans1,j-i-1);i=j-1;break;}
			}
		}
		for (int i=0; i<n ; i++ ) {
			if(s[i]=='(') {
				int c=0;
				for(int j=i+1; j<n ; j++)
					{
						if(s[j]==')') {if(c>0)++ans2; break;}
						if(s[j]!='(' && s[j]!='_' && s[j]!=')')++c;
						if(s[j]=='_' && c>0) {++ans2;c=0;}
					}
			}
		}
		ob.println(ans1+" "+ans2);
	}
	String ns()throws IOException {
		return nextToken();
	}
	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}
	String nextToken() throws IOException {
		if(st==null || !st.hasMoreTokens())
			st=new StringTokenizer(in.readLine());
		return st.nextToken();
	}
}

import java.util.Scanner;
import java.lang.Math;

public class Document{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);

        int strLength = scan.nextInt();

        char[] str = scan.next().toCharArray();

        int longestWord = 0;
        int numInsides = 0;

        boolean inside = false;
        int wordLength = 0;

        for(char c : str){
            if(c == '(' || c == '_' || c == ')'){
                if(!inside){
                    longestWord = Math.max(longestWord, wordLength);
                }
                wordLength = 0;
            }

            if(c == '('){
                inside = true;
            }else if (c == ')'){
                inside = false;
            }

            if(inside){
                if(c == '_' || c== ')'){
                    numInsides++;
                }
            }
        }

        System.out.println(numInsides+ " " + longestWord);
    }
}

import java.util.*;
import java.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;
	PrintWriter out;

	private String next() throws Exception{
		while (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		// int n = nextInt();
		char []a = next().toCharArray();
		int n = a.length;

		int count = 0;
		for(int i = 0; i < n; ++i) {
			if (a[i] == '(') {
				int j = i + 1;
				while(j < n && a[j] != ')') ++j;
				count += count(i + 1, j - 1, a);
			}
		}

		int max = 0;
		int l = 0;
		for(int i = 0; i < n; ++i) {
			if (a[i] == '(') {
				max = Math.max(max, max(l, i - 1, a));
				int j = i;
				while(j < n && a[j] != ')') ++j;
				l = j + 1;
			}
		}
		if (l == 0) {
			max = Math.max(l, n - 1);
		}

		out.println(max + " " + count);
		out.close();
	}

	private int count(int l, int r, char []a) {
		int ret = 0, c = 0;
		for(int i = l; i <= r; ++i) {
			if (a[i] == '_') {
				if (c > 0) ++ret;
				c = 0;
			} else {
				++c;
			}
		}
		if (c > 0) ++ret;
		return ret;
	}

	private int max(int l, int r, char []a) {
		int ret = 0, c = 0;
		for(int i = l; i <= r; ++i) {
			if (a[i] == '_') {
				ret = Math.max(ret, c);
				c = 0;
			} else {
				++c;
			}
		}
		ret = Math.max(ret, c);
		return ret;
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}

    import java.lang.reflect.Array;
    import java.util.Scanner;
    import java.io.*;
    import java.util.*;
    import java.math.*;
    import java.lang.*;
    import static java.lang.Math.*;
    public class main implements Runnable {

        static ArrayList<Integer> adj[];

        static void Check2(int n) {
            adj = new ArrayList[n + 1];
            for (int i = 0; i <= n; i++) {
                adj[i] = new ArrayList<>();
            }

        }

        static void add(int i, int j) {
    adj[i].add(j);
    adj[j].add(i);
        }

        public static void main(String[] args) {
            new Thread(null, new main(), "Check2", 1 << 26).start();// to increse stack size in java
        }

        static long mod = (long) (1e9 + 7);

        public void run() {
                        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
            //Scanner in=new Scanner(System.in);

            InputReader in = new InputReader(System.in);
            PrintWriter w = new PrintWriter(System.out);

                int n=in.nextInt();
                char c[]=in.next().toCharArray();

                int maxin=0;
                int maxout=0;
                int flag=0;
                int co=0;
                int flag2=0;
                for(int i=0;i<c.length;i++){

                    if(c[i]=='_'&&flag==0){
                        continue;
                    }

                    else if(c[i]=='('){
                        flag=1;
                    }
                    else if(c[i]==')'){
                          if(flag2==1)co++;
                        flag=0;
                        flag2=0;
                    }
                    else if(flag==1){
                        if(c[i]=='_'&&flag2==1){
                            flag2=0;

                            co++;

                        }
                        else if(c[i]!='_'){
                            flag2=1;

                        }

                    }

//                    w.println(c[i]+" "+co+" "+flag2);
                }
                maxin=co;
                co=0;
            for(int i=0;i<c.length;i++){

                    if(c[i]=='_')co=0;
                if(c[i]=='('){
                    flag=1;
                }
                else if(c[i]!=')'&&flag==0){
                    if(c[i]=='_')co=0;
                    else co++;
                }
                else if(c[i]==')'){
                    flag=0;
                }
                maxout=max(maxout,co);

            }
            w.println(maxout+" "+maxin);

            w.close();
        }

            static class pair{

            int a,b,dis,time;

            pair(int c,int d){
                a=c;
                b=d;
            }

        }

        static long power(long x,long y){
            if(y==0)return 1%mod;
            if(y==1)return x%mod;

            long res=1;
            x=x%mod;
            while(y>0){

                if((y%2)!=0){
                    res=(res*x)%mod;
                }

                y=y/2;
                x=(x*x)%mod;
            }

            return res;

        }

        static  int gcd(int a,int b){

            if(b==0)return a;
            return gcd(b,a%b);
        }

        static  void sev(int a[],int n){

            for(int i=2;i<=n;i++)a[i]=i;
            for(int i=2;i<=n;i++){

                if(a[i]!=0){
                    for(int j=2*i;j<=n;){

                        a[j]=0;
                        j=j+i;
                    }
                }

            }

        }

        static class node{

            int y;
            int val;

            node(int a,int b){

                y=a;
                val=b;

            }

        }

        static class InputReader
        {
            private InputStream stream;
            private byte[] buf = new byte[1024];
            private int curChar;
            private int numChars;
            private SpaceCharFilter filter;

            public InputReader(InputStream stream)
            {
                this.stream = stream;
            }

            public int read()
            {
                if (numChars==-1)
                    throw new InputMismatchException();

                if (curChar >= numChars)
                {
                    curChar = 0;
                    try
                    {
                        numChars = stream.read(buf);
                    }
                    catch (IOException e)
                    {
                        throw new InputMismatchException();
                    }

                    if(numChars <= 0)
                        return -1;
                }
                return buf[curChar++];
            }

            public String nextLine()
            {
                BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
                String str = "";
                try
                {
                    str = br.readLine();
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
                return str;
            }
            public int nextInt()
            {
                int c = read();

                while(isSpaceChar(c))
                    c = read();

                int sgn = 1;

                if (c == '-')
                {
                    sgn = -1;
                    c = read();
                }

                int res = 0;
                do
                {
                    if(c<'0'||c>'9')
                        throw new InputMismatchException();
                    res *= 10;
                    res += c - '0';
                    c = read();
                }
                while (!isSpaceChar(c));

                return res * sgn;
            }

            public long nextLong()
            {
                int c = read();
                while (isSpaceChar(c))
                    c = read();
                int sgn = 1;
                if (c == '-')
                {
                    sgn = -1;
                    c = read();
                }
                long res = 0;

                do
                {
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    res *= 10;
                    res += c - '0';
                    c = read();
                }
                while (!isSpaceChar(c));
                return res * sgn;
            }

            public double nextDouble()
            {
                int c = read();
                while (isSpaceChar(c))
                    c = read();
                int sgn = 1;
                if (c == '-')
                {
                    sgn = -1;
                    c = read();
                }
                double res = 0;
                while (!isSpaceChar(c) && c != '.')
                {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    res *= 10;
                    res += c - '0';
                    c = read();
                }
                if (c == '.')
                {
                    c = read();
                    double m = 1;
                    while (!isSpaceChar(c))
                    {
                        if (c == 'e' || c == 'E')
                            return res * Math.pow(10, nextInt());
                        if (c < '0' || c > '9')
                            throw new InputMismatchException();
                        m /= 10;
                        res += (c - '0') * m;
                        c = read();
                    }
                }
                return res * sgn;
            }

            public String readString()
            {
                int c = read();
                while (isSpaceChar(c))
                    c = read();
                StringBuilder res = new StringBuilder();
                do
                {
                    res.appendCodePoint(c);
                    c = read();
                }
                while (!isSpaceChar(c));

                return res.toString();
            }

            public boolean isSpaceChar(int c)
            {
                if (filter != null)
                    return filter.isSpaceChar(c);
                return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
            }

            public String next()
            {
                return readString();
            }

            public interface SpaceCharFilter
            {
                public boolean isSpaceChar(int ch);
            }
        }

    }

import java.util.*;
import java.io.*;

public class Main {

    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        String text = in.next();

        ArrayList<String> Inside = new ArrayList<>();
        ArrayList<String> Outside = new ArrayList<>();

        boolean isOut = true;
        for (int i = 0; i < text.length(); i++) {
            if (text.charAt(i) == '_' && isOut) {
                isOut = true;
                int j = i + 1;
                for (; j < text.length(); j++) {
                    if (text.charAt(j) == '_' || text.charAt(j) == '(' || text.charAt(j) == ')') {
                        break;
                    }
                }
                Outside.add(text.substring(i + 1, j));
            } else if (text.charAt(i) == '(' || text.charAt(i) == '_') {
                isOut = false;

                int j = i + 1;
                for (; j < text.length(); j++) {
                    if (text.charAt(j) == '_') {
                        break;
                    } else if (text.charAt(j) == ')') {
                        isOut = true;
                        break;
                    }
                }
                Inside.add(text.substring(i + 1, j));
            }
        }

        int MaxOut = 0;
        int MaxIn = 0;

        for (int i = 0; i < Outside.size(); i++) {
            MaxOut = Math.max(MaxOut, Outside.get(i).length());
        }

        for (int i = 0; i < Inside.size(); i++) {
            if (Inside.get(i).length() > 0) {
                MaxIn++;
            }
        }

        out.println(MaxOut + " " + MaxIn);
        out.close();
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}

/*
 * CODRE: ATIKUR RAHMAN
 * DATE: 29/10/2016
 *
 * */

import java.util.Scanner;

public class P_B_Text_Document_Analysis {
	static int outMax, inMax, count = 0;

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int stringLen = scanner.nextInt();

		String text = scanner.next();

		scanner.close();
		int i = 0;

		try {
			while (true) {

				if (text.charAt(i) == '(') {
					while (true) {
						int c=0;
							while (text.charAt(i) != '_' && text.charAt(i)!=')' && text.charAt(i)!='(') {
								if (c==0) {
									inMax++;
									c++;
								}
								i++;
							}

						if (text.charAt(i)==')') {
							count=0;
							break;

						}
						count=0;
						i++;
					}
				} else {
					while (true) {

							while (text.charAt(i) != '_' && text.charAt(i)!=')' && text.charAt(i)!='(') {
								count++;
								i++;
							}

						if (outMax < count) {
							outMax = count;
							count = 0;
						}

						if (text.charAt(i)=='(') {
							count=0;
							break;
						}
						count=0;
						i++;
					}
				}
			}
		} catch (Exception e) {

		}

		System.out.print(outMax + " " + inMax);

	}

}

import java.util.*;
import java.math.*;
import java.io.*;
 public class Main{

    static FastReader scan=new FastReader();
   public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
 static int mod(int x,int y)
    {
        if(x<0)
            x=x+(-x/y+1)*y;
        return x%y;
    }
    static int A=400,n;
    static int l[]=new int[5050];
    static int r[]=new int[5050];
    static char c[]=new char[5050];
static int solve(int x){
	int a=0,b=0;
	for(int i=0;i<n;i++)
	{
		if(x<l[i]||x>r[i])
			continue;
		if(c[i]=='M')
			a++;
		else b++;
	}
	return Math.min(a,b);
}
public static void main(String[] args)  throws IOException
{
 n=scan.nextInt();
String s=scan.next();
int cur=0,c=0,a=0,b=0;
for(int i=0;i<n;i++){
	if(s.charAt(i)=='('||s.charAt(i)==')'||s.charAt(i)=='_'){
		if(c>0){
			if(cur>0)b++;
			else a=Math.max(c,a);
			c=0;
		}
		if(s.charAt(i)=='(')
			cur=1;
		if(s.charAt(i)==')')cur=0;
	}
	else c++;
}
out.println(a+" "+b);
out.close();
}

 public static  long pow(long b, long e) {
            long r = 1;
            while (e > 0) {
                if (e % 2 == 1) r = r * b ;
                b = b * b;
                e >>= 1;
            }
            return r;
        }
private static void sort(long[] arr) {
        List<Long> list = new ArrayList<>();
        for (long object : arr) list.add(object);
        Collections.sort(list);
        for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);
    }
 public static class FastReader {
        BufferedReader br;
        StringTokenizer root;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (root == null || !root.hasMoreTokens()) {
                try {
                    root = new StringTokenizer(br.readLine());
                } catch (Exception addd) {
                    addd.printStackTrace();
                }
            }
            return root.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (Exception addd) {
                addd.printStackTrace();
            }
            return str;
        }
         public int[] nextIntArray(int arraySize) {
            int array[] = new int[arraySize];

            for (int i = 0; i < arraySize; i++) {
                array[i] = nextInt();
            }

            return array;
        }
}
static class pair{
	int i;
	int j;
pair(int i,int j){
	this.i=i;
	this.j=j;
}

}}

import java.util.Scanner;

/**
 * Created by Sersh on 03.10.2016.
 */
public class lilu {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int max_size = 0;
        int num_words = 0;
        int max_size1 = 0;
        int k = -1;
        int tmp_size = 0;
        int tmp_size1 = 0;
        boolean scob = false;
        String str = in.next();
        char [] arr = str.toCharArray();
        for(int i=0; i<n;i++){
            if(arr[i]=='(') {
                scob = true;
                k=1;
                if(tmp_size1!=0){
                    max_size = Math.max(max_size,tmp_size1);
                    tmp_size1 = 0;
                }
                if(arr[i+1]!='_' && arr[i+1]!=')')
                    num_words++;
            }
            if(arr[i]==')') {
                scob = false;
                if(arr[i-1]!='_' && arr[i-1]!='(')
                    if(k==-1 || (i>3 && arr[i-2]=='_' && (arr[i-3]=='_' || arr[i-3]=='(')))
                        num_words++;

                k=-1;
            }
            if(scob){
                if(arr[i]=='_' && arr[i-1]!='_'){
                    if(arr[i-1]!='(' && arr[i+1]!=')') {
                        num_words++;
                        k=1;
                    }
                }
                /*if(arr[i]=='_' && arr[i+1]!='_' && arr[i+1]!='(' && arr[i+1]!=')') {
                    //if(arr[i-1]!='(' && arr[i+1]!=')') {
                    num_words++;
                    k = 1;
                    // }
                }*/
            }
            else{
                if(arr[i]!='_' && arr[i]!=')' && arr[i]!='('){
                    tmp_size1++;
                    if(i==(n-1)){
                        max_size = Math.max(max_size, tmp_size1);
                    }
                }else{
                    if(tmp_size1!=0) {
                        max_size = Math.max(max_size, tmp_size1);
                        tmp_size1 = 0;
                    }
                }
            }
        }

        System.out.println(max_size+" "+num_words);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class TextDocumentAnalysis {
	static String s;

	public static void main(String[] args) throws NumberFormatException, IOException {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		s = sc.next();
		ArrayList<Integer> open = new ArrayList<>();
		ArrayList<Integer> closed = new ArrayList<>();
		ArrayList<Integer> und = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			if (s.charAt(i) == '(')
				open.add(i);
			else if (s.charAt(i) == ')')
				closed.add(i);
			else if (s.charAt(i) == '_')
				und.add(i);

		}
		int len = 0;
		int maxLen = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == '(') {
				i = paren(i);
				len = 0;
			} else if (Character.isAlphabetic(s.charAt(i)))
				len++;
			else {
				maxLen = Math.max(maxLen, len);
				len = 0;
			}
		}
//		System.out.println(len);
		maxLen = Math.max(maxLen, len);
		System.out.println(maxLen + " " + wordInside);

	}

	static int wordInside;

	static int paren(int n) {
		boolean word = false;
//		System.out.println(n);
		for (int i = n;; i++) {
			if (s.charAt(i) == ')') {
				if (word)
					wordInside++;
//				System.out.println(i + " " + wordInside);
				return i;
			}
			if (Character.isAlphabetic(s.charAt(i)))
				word = true;
			if (s.charAt(i) == '_' && word) {

				wordInside++;
//				System.out.println(i + " " + wordInside);
				word = false;
			} else if (s.charAt(i) == '_')
				word = false;

		}
	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}
	}
}

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();

		boolean insideBrackets = false;
		int countNoInside = 0, countMax = 0, wordSize = 0;

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

			char c = s.charAt(i);

			if(c!='(' && c!=')' && c!='_')
				wordSize++;
			if(c == '('){
				countMax = Math.max(countMax, wordSize);
				wordSize = 0;
				insideBrackets = true;
			}

			if(c == ')'){
				insideBrackets = false;
				if(wordSize>0){
					countNoInside++;
					wordSize = 0;
				}

			}
			if(c == '_'){
				if(insideBrackets && wordSize>0)
					countNoInside++;
				else if(c == '_' && !insideBrackets)
					countMax = Math.max(countMax, wordSize);
				wordSize = 0;
			}

		}
		System.out.println(countMax + " " + countNoInside);

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public Scanner(FileReader r){	br = new BufferedReader(r);}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {return Integer.parseInt(next());}

		public long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException { return Double.parseDouble(next()); }

		public boolean ready() throws IOException {return br.ready();}

	}

}

import java.util.Scanner;

/**
 * Created by Sersh on 03.10.2016.
 */
public class lilu {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int max_size = 0;
        int num_words = 0;
        int max_size1 = 0;
        int k = -1;
        int tmp_size = 0;
        int tmp_size1 = 0;
        boolean scob = false;
        String str = in.next();
        char [] arr = str.toCharArray();
        for(int i=0; i<n;i++){
            if(arr[i]=='(') {
                scob = true;
                k=1;
                if(tmp_size1!=0){
                    max_size = Math.max(max_size,tmp_size1);
                    tmp_size1 = 0;
                }
                if(arr[i+1]!='_' && arr[i+1]!=')')
                    num_words++;
            }
            if(arr[i]==')') {
                scob = false;
                if(arr[i-1]!='_' && arr[i-1]!='(')
                    if(k==-1 || (i>3 && arr[i-2]=='_' && arr[i-3]=='_'))
                        num_words++;

                k=-1;
            }
            if(scob){
                if(arr[i]=='_' && arr[i-1]!='_'){
                    if(arr[i-1]!='(' && arr[i+1]!=')') {
                        num_words++;
                        tmp_size++;
                        k=1;
                    }
                }
            }
            else{
                if(arr[i]!='_'){
                    tmp_size1++;
                }else{
                    if(tmp_size1!=0) {
                        max_size = Math.max(max_size, tmp_size1);
                        tmp_size1 = 0;
                    }
                }
            }
        }

        System.out.println(max_size+" "+num_words);
    }
}

import java.io.*;
import java.util.*;
import java.math.*;
public class forces{
/*
  public static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    static class Reader
      {
          final private int BUFFER_SIZE = 1 << 16;
          private DataInputStream din;
          private byte[] buffer;
          private int bufferPointer, bytesRead;

          public Reader()
          {
              din = new DataInputStream(System.in);
              buffer = new byte[BUFFER_SIZE];
              bufferPointer = bytesRead = 0;
          }

          public Reader(String file_name) throws IOException
          {
              din = new DataInputStream(new FileInputStream(file_name));
              buffer = new byte[BUFFER_SIZE];
              bufferPointer = bytesRead = 0;
          }

          public String readLine() throws IOException
          {
              byte[] buf = new byte[64]; // line length
              int cnt = 0, c;
              while ((c = read()) != -1)
              {
                  if (c == '\n')
                      break;
                  buf[cnt++] = (byte) c;
              }
              return new String(buf, 0, cnt);
          }

          public int nextInt() throws IOException
          {
              int ret = 0;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();
              do
              {
                  ret = ret * 10 + c - '0';
              }  while ((c = read()) >= '0' && c <= '9');

              if (neg)
                  return -ret;
              return ret;
          }

          public long nextLong() throws IOException
          {
              long ret = 0;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();
              do {
                  ret = ret * 10 + c - '0';
              }
              while ((c = read()) >= '0' && c <= '9');
              if (neg)
                  return -ret;
              return ret;
          }

          public double nextDouble() throws IOException
          {
              double ret = 0, div = 1;
              byte c = read();
              while (c <= ' ')
                  c = read();
              boolean neg = (c == '-');
              if (neg)
                  c = read();

              do {
                  ret = ret * 10 + c - '0';
              }
              while ((c = read()) >= '0' && c <= '9');

              if (c == '.')
              {
                  while ((c = read()) >= '0' && c <= '9')
                  {
                      ret += (c - '0') / (div *= 10);
                  }
              }

              if (neg)
                  return -ret;
              return ret;
          }

          private void fillBuffer() throws IOException
          {
              bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
              if (bytesRead == -1)
                  buffer[0] = -1;
          }

          private byte read() throws IOException
          {
              if (bufferPointer == bytesRead)
                  fillBuffer();
              return buffer[bufferPointer++];
          }

          public void close() throws IOException
          {
              if (din == null)
                  return;
              din.close();
          }
      }
      static long power(long k){
        long t=k&1,count=0;
        while(k!=0){
          if(t==0)
            count++;
          k=k>>1;
          t=k&1;
        }
        return count;
      }*/
  static long largest_power(long N)
  {
      //changing all right side bits to 1.
      N = N| (N>>1);
      N = N| (N>>2);
      N = N| (N>>4);
      N = N| (N>>8);
      N = N| (N>>16);
      N = N| (N>>32);
      return (N+1)>>1;

  }
  public static void main (String args[]) throws IOException{
      //Reader in = new Reader();
      BufferedOutputStream out=new BufferedOutputStream(System.out);

      //BufferedReader in =new BufferedReader(new InputStreamReader(System.in));
      StringBuilder sb = new StringBuilder();
      Scanner in=new Scanner(System.in);
      int i,n=in.nextInt(),k=0,count=0;
      String z=in.next();
      int []ans=new int[2];
      for(i=0;i<n;i++){
        if(z.charAt(i)=='_'){
          if(count>ans[k]&&k==0)
            ans[k]=count;
          else if(k==1){
            if(count>0)
              ans[k]++;
          }
          count=0;
        }
        else if(z.charAt(i)=='('){
          k=1;
          if(count>ans[0])
            ans[0]=count;
          count=0;
        }
        else if(z.charAt(i)==')'){
          k=0;
          if(count>0)
            ans[1]++;
          count=0;
        }
        else{
          count++;
        }
      }
      sb.append(ans[0]+" "+ans[1]+"\n");
      //sb=sb.append(count);
      out.write(sb.toString().getBytes());

      out.flush();
      in.close();
    }
}
class Reader {
 final private int BUFFER_SIZE = 1<<16;
 private DataInputStream din;
 private byte[] buffer;
 private int bufferPointer, bytesRead;

 public Reader() {
   din = new DataInputStream(System.in);
   bytesRead = bufferPointer = 0;
   buffer = new byte[BUFFER_SIZE];
 }

 public Reader(String filename) throws IOException {
   din = new DataInputStream(new FileInputStream(filename));
   bytesRead = bufferPointer = 0;
   buffer = new byte[BUFFER_SIZE];
 }

 private byte read() throws IOException{
   if (bufferPointer == bytesRead) {
     fillBuffer();
   }
   return buffer[bufferPointer++];
 }

 private void fillBuffer() throws IOException{
   bytesRead = din.read(buffer, bufferPointer = 0 , BUFFER_SIZE);
   if (bytesRead == -1) {
     buffer[0] = -1;
   }
 }

 public void close() throws IOException {
   if (din != null) {
     din.close();
   }
 }

 public String nextLine() throws IOException {
   byte[] buf = new byte[64];
   int cnt = 0;
   byte c;
   while (isWhiteSpace(c = read())) {}
   while (c != -1) {
     if (c == '\n') {
       break;
     }
     buf[cnt++] = c;
     c = read();
   }
   return new String(buf, 0 , cnt);
 }
 public int nextLine(int size) throws IOException {
   int cnt = 0;
   byte c;
   while (isWhiteSpace(c = read())) {}
   for (int i = 0 ; i < size ; i++) {
     if (c == '0') {
         cnt++;
     }
     c = read();
   }
   return cnt;
 }

 public String next() throws IOException {
   byte[] buf = new byte[64];
   int cnt = 0;
   byte c;
   while (isWhiteSpace(c = read())) {}
   while (c != -1) {
     if (isWhiteSpace(c)) {
       break;
     }
     buf[cnt++] = c;
     c = read();
   }
   return new String(buf, 0 , cnt);
 }

 public String next(int size) throws IOException {
   byte[] buf = new byte[size];
   int cnt = 0;
   byte c;
   while (isWhiteSpace(c = read())) {}
   while (c != -1) {
     if (isWhiteSpace(c)) {
       break;
     }
     buf[cnt++] = c;
     c = read();
   }
   return new String(buf, 0 , cnt);
 }

 public boolean isWhiteSpace(byte n) {
   return (n == ' ' || n == '\n' || n == '\r' || n == '\t');
 }

 public char nextChar() throws IOException {
   byte c = read();
   while (isWhiteSpace(c))
     c = read();
   return (char)c;
 }

 public int nextInt() throws IOException {
   int ret = 0;
   byte c = read();
   while (isWhiteSpace(c))
     c = read();
   boolean neg = (c == '-');
   if (neg)
     c = read();
   if (!(c >= '0' && c <= '9'))
     throw new InputMismatchException();
   do {
     ret = ret * 10 + c - '0';
   } while ((c = read()) >= '0' && c <='9');
   if (neg)
     return -ret;
   return ret;
 }

 public long nextLong() throws IOException {
   long ret = 0;
   byte c = read();
   while (isWhiteSpace(c))
     c = read();
   boolean neg = (c == '-');
   if (neg)
     c = read();
   if (!(c >= '0' && c <= '9'))
     throw new InputMismatchException();
   do {
     ret = ret * 10 + c - '0';
   } while ((c = read()) >= '0' && c <='9');
   if (neg)
     return -ret;
   return ret;
 }

 public double nextDouble() throws IOException {
   double ret = 0 , div = 1;
   byte c = read();
   while (isWhiteSpace(c))
     c = read();
   boolean neg = (c == '-');
   if (neg)
     c = read();
   do {
     ret = ret * 10 + c - '0';
   } while ((c = read()) >= '0' && c <= '9');

   if (c == '.') {
     while ((c = read()) >= '0' && c <= '9') {
       ret += (c - '0') / (div *= 10);
     }
   }

   if (neg)
     return -ret;
   return ret;
 }
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        int n = Reader.nextInt() ;
        String s = Reader.next();
        boolean in = false , word = false , longest = false  ;
        int c = 0 , max = 0 , temp = 0;
        for (int i=0 ; i<s.length() ; i++) {
            if (s.charAt(i)=='(') {
                in = true ;
                continue ;
            }else if (s.charAt(i)==')') {
                if (word) {
                    c++;
                }
                in = false ;
                continue ;
            }
            if (in) {
                if (s.charAt(i)!='_') {
                    word = true ;
                }
                if (s.charAt(i)=='_'&&word) {
                    word = false ;
                    c++;
                }
            } else {
                if (s.charAt(i)!='_') {
                    temp++;
                    longest=true;
                } else {
                    longest=false;
                    max = Math.max(temp,max);
                    temp = 0 ;
                }
            }
        }
        if (longest) {
            max = Math.max(max,temp);
        }
        System.out.println(max+" "+c);

    }

}
class Pair {
    int x ;
    int y ;

    Pair (int x , int y) {
        this.x = x ;
        this.y = y ;
    }
}
class Reader {

        static BufferedReader reader;
        static StringTokenizer tokenizer;

        public static int pars(String x) {
            int num = 0;
            int i = 0;
            if (x.charAt(0) == '-') {
                i = 1;
            }
            for (; i < x.length(); i++) {
                num = num * 10 + (x.charAt(i) - '0');
            }

            if (x.charAt(0) == '-') {
                return -num;
            }

            return num;
        }

        static void init(InputStream input) {
            reader = new BufferedReader(
                    new InputStreamReader(input));
            tokenizer = new StringTokenizer("");
        }

        static void init(FileReader input) {
            reader = new BufferedReader(input);
            tokenizer = new StringTokenizer("");
        }

        static String next() throws IOException {
            while (!tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(
                        reader.readLine());
            }
            return tokenizer.nextToken();
        }

        static int nextInt() throws IOException {
            return pars(next());
        }

        static long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        static double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }

import java.util.*;
import java.io.*;

public class Main {

    static InputReader in = new InputReader(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int n = in.nextInt();
        String text = in.next();

        ArrayList<String> Inside = new ArrayList<>();
        ArrayList<String> Outside = new ArrayList<>();

        boolean isOut = true;
        for (int i = 0; i < text.length(); i++) {
            if (text.charAt(i) == '_' && isOut) {
                isOut = true;
                int j = i + 1;
                for (; j < text.length(); j++) {
                    if (text.charAt(j) == '_' || text.charAt(j) == '(' || text.charAt(j) == ')') {
                        break;
                    }
                }
                Outside.add(text.substring(i + 1, j));
            } else if (text.charAt(i) == '(' || text.charAt(i) == '_') {
                isOut = false;

                int j = i + 1;
                for (; j < text.length(); j++) {
                    if (text.charAt(j) == '_') {
                        break;
                    } else if (text.charAt(j) == ')') {
                        isOut = true;
                        break;
                    }
                }
                Inside.add(text.substring(i + 1, j));
            } else if (isOut && i == 0) {
                int j = i + 1;
                for (; j < text.length(); j++) {
                    if (text.charAt(j) == '_' || text.charAt(j) == '(' || text.charAt(j) == ')') {
                        break;
                    }
                }
                Outside.add(text.substring(i, j));
            }
        }

        int MaxOut = 0;
        int MaxIn = 0;

        for (int i = 0; i < Outside.size(); i++) {
            if (Outside.get(i).length() > 0) {
                MaxOut = Math.max(MaxOut, Outside.get(i).length());
            }
        }

        for (int i = 0; i < Inside.size(); i++) {
            if (Inside.get(i).length() > 0) {
                MaxIn++;
            }
        }

        out.println(MaxOut + " " + MaxIn);
        out.close();
    }

    static class InputReader {

        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}

import java.io.*;
import java.util.*;
public class div375B
{
	BufferedReader in;
	PrintWriter ob;
	StringTokenizer st;
	public static void main(String[] args) throws IOException {
		new div375B().run();
	}
	void run() throws IOException {
		in=new BufferedReader(new InputStreamReader(System.in));
		ob=new PrintWriter(System.out);
		solve();
		ob.flush();
	}
	void solve() throws IOException {
		int n=ni();
		char s[]=ns().toCharArray();
		int ans1=0,ans2=0;
		int flag=0;
		for (int i=0; i<n ; i++ ) {
			if(s[i]=='_' || s[i]=='(' || s[i]==')') {
				int c=0,j=i+1;
				if(j<n){
					for(; j<n ; j++) {
						if(s[j]=='_' || s[j]=='(' || s[j]==')') break;
						++c;
					}
					if(j!=n)
					{
					if(s[i]=='_' && (s[j]=='(' || s[j]=='_'))
						ans1=Math.max(ans1,c);
					if(s[i]==')' && s[j]=='_')
						ans1=Math.max(ans1,c);
					if(s[i]=='(' && (s[j]=='_' || s[j]==')') && c>0)
						++ans2;
					if(s[i]=='_' && s[j]==')' && c>0)
						++ans2;
					if(flag==1 && (s[j]!=')') && (s[i]=='_' && s[j]=='_' && c>0)) ++ans2;
					if(flag==1 && s[j]==')') flag=0;
					if(s[i]=='(' && s[j]!=')') flag=1;
					}
				}
				i=j-1;
			}
		}
		ob.println(ans1+" "+ans2);
	}
	String ns()throws IOException {
		return nextToken();
	}
	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}
	String nextToken() throws IOException {
		if(st==null || !st.hasMoreTokens())
			st=new StringTokenizer(in.readLine());
		return st.nextToken();
	}
}

import java.util.*;
import java.math.*;
import java.io.*;

public class rnd375_B {
 static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
                return "";
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
static class P implements Comparable{

        private int x, y;

        public P(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public int hashCode() {
            return (x * 31) ^ y;
        }

        public boolean equals(Object o) {
            if (o instanceof P) {
                P other = (P) o;
                return (x == other.x && y == other.y);
            }
            return false;
        }
        public int compareTo(Object obj) {
		P l = (P) obj;
		if (this.x == l.x){
			if (this.y == l.y) return 0;
			return (this.y < l.y)? -1: 1;
		}
		return (this.x < l.x)? -1: 1;
	}
    }

public static void main(String[] args){

    FastScanner s = new FastScanner(System.in);
    StringBuilder op=new StringBuilder();
    int n=s.nextInt();
    String ip=s.next();
    int mwl=0;
    int wc=0;
    for (int i=0;i<ip.length();){
        if(ip.charAt(i)=='('){
            i++;
            int l=0;
            while(i<ip.length()){
                if(ip.charAt(i)==')'){
                    if(ip.charAt(i-1)!='('&& ip.charAt(i-1)!='_')wc++;
                    i++;
                    break;
                }
                else if(ip.charAt(i)=='_'){
                    mwl=Math.max(l,mwl);
                    l=0;
                    if(ip.charAt(i-1)!='('&&ip.charAt(i-1)!='_')
                    wc++;
                }
                else
                    l++;

                i++;
            }
        }
        else if(ip.charAt(i)=='_')i++;
        else {
            int cl=1;
            //System.out.println(i+"-");
            i++;
            while(i<ip.length()){
                if(ip.charAt(i)=='_'||ip.charAt(i)=='(')
                {
                    mwl=Math.max(mwl,cl);

                    break;
                }
                else {
                    i++;
                    cl++;
                    mwl=Math.max(mwl,cl);
                }
            }
        }
       // System.out.println(mwl+" "+wc+" "+i);

    }
    System.out.println(mwl + " "+wc);

}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created by Irina on 03.10.2016.
 */
public class Solution {

    static int[] count_in(int i, String s){
        int c[] = new int[2];
        c[0] = 0;
        int tmp = 0;

        OUT: for ( int j = i; j < s.length(); j++) {
            if(s.charAt(j) == 41){
                c[1] = j+1;
                break OUT;
            }
            if(s.charAt(j) != 95){
                c[0]++;
                while(s.charAt(j) != 95){
                    if(s.charAt(j) == 41){
                        c[1] = j+1;
                        break OUT;
                    }
                    j++;
                }
            }
        }

        return c;
    }

    public static void main(String[] args) throws IOException{

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String s = br.readLine();
        int max = 0;
        int count = 0;
        int i = 0;
        int tmp = 0;
        int a[] = new int[2];
        while(s.charAt(i) == 95){
            i++;
        }
        for (int j = i; j < n; j++) {
            if(s.charAt(j) == 40){
                max = Math.max(max, tmp);
                tmp = 0;
                a = count_in(j+1, s);
                count += a[0];
                j = a[1];
                if (j >= n){
                    break;
                }
            }
            if(s.charAt(j) == 95){
                max = Math.max(max, tmp);
                tmp = 0;
            }
            if(s.charAt(j) != 95 && s.charAt(j) != 40) {
                tmp++;
            }
        }

        System.out.println(max + " " + count);

    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;

public class TextRed {
    public static void main(String[] args) {
        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            int len = Integer.parseInt(reader.readLine());
            String s = reader.readLine();
            reader.close();

            int lenverb = 0;
            int verbCount = 0;

            int x = 0;
            ArrayList<Integer> list = new ArrayList<Integer>();
            boolean inScob = false;
            char[] array = s.toCharArray();
            for (char c : array) {
                if (c == '(') {
                    inScob = true;
                    list.add(x);
                    x = 0;
                    continue;
                } else if (c == ')') {
                    inScob = false;
                    continue;
                }

                if (inScob == false && c != '_') {
                    x++;
                } else if (inScob == false && c == '_') {
                    list.add(x);
                    x = 0;
                }
            }

            System.out.print(Collections.max(list) + " ");

            x = 0;
            inScob = false;
            for (char c:array)
            {
                if (c == '(') {
                  inScob = true;
                    x = 0;
                    continue;
                } else if (c == ')') {
                   inScob = false;
                    if (x != 0)
                    {
                        verbCount++;
                    }
                    x = 0;
                    continue;
                }

                if (inScob && c != '_' )
                {
                    x++;
                }else if (inScob && c == '_')
                {
                    if (x != 0)
                    {
                        verbCount++;
                    }
                    x = 0;
                }
            }

            System.out.print(verbCount);
        }catch (Exception e)
        {
            System.out.print(0 + " " + 0);
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class TextDocumentAnalysis {
	static String s;

	public static void main(String[] args) throws NumberFormatException, IOException {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		s = sc.next();
		ArrayList<Integer> open = new ArrayList<>();
		ArrayList<Integer> closed = new ArrayList<>();
		ArrayList<Integer> und = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			if (s.charAt(i) == '(')
				open.add(i);
			else if (s.charAt(i) == ')')
				closed.add(i);
			else if (s.charAt(i) == '_')
				und.add(i);

		}
		int len = 0;
		int maxLen = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == '(') {
				i = paren(i);
				// System.out.println(wordInside);
			} else if (Character.isAlphabetic(s.charAt(i)))
				len++;
			else {
				maxLen = Math.max(maxLen, len);
				len = 0;
			}
		}
		maxLen = Math.max(maxLen, len);
		System.out.println(maxLen + " " + wordInside);

	}

	static int wordInside;

	static int paren(int n) {
		boolean word = false;
//		System.out.println(n);
		for (int i = n;; i++) {
			if (s.charAt(i) == ')') {
				if (word)
					wordInside++;
//				System.out.println(i + " " + wordInside);
				return i;
			}
			if (Character.isAlphabetic(s.charAt(i)))
				word = true;
			if (s.charAt(i) == '_' && word) {

				wordInside++;
//				System.out.println(i + " " + wordInside);
				word = false;
			} else if (s.charAt(i) == '_')
				word = false;

		}
	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}
	}
}

 import java.util.Scanner;

    public class JavaApplication1 {

    public static void main(String[] args)
    {

        Scanner sc=new Scanner(System.in);
        String s,ss="";int i,flag=0,max=0;
        s=sc.nextLine();
        s=sc.nextLine();
        s=s.replaceAll("_+", " ").trim();
        for(i=0;i<s.length();i++)
        {
            if(s.charAt(i) == '(')
                flag=1;
            else if(s.charAt(i) == ')')
            {
                ss+=" ";
                flag=0;
            }
            else if(flag == 1)
                ss+=s.charAt(i);
        }
        for(i=0;i<s.length();i++)
            if(s.charAt(i) == ')')
            {
                s=s.substring(0,s.indexOf("("))+" "+s.substring(i+1);
                i=0;
            }
            else if(s.charAt(i) == ')' && i == s.length()-1)
            {
                s=s.substring(0,s.indexOf("("));
                i=0;
            }
        s=s.replaceAll(" +", " ").trim();
        ss=ss.replaceAll(" +"," ").trim();
        String []out=s.split(" ");
        String []in=ss.split(" ");
        for(i=0;i<out.length;i++)
        {
            System.out.println(out[i]);
            if(out[i].length() > max)
                max=out[i].length();
        }
        if(!ss.equals("") && !ss.equals(" "))
            System.out.println(s+" "+in.length);
        else
            System.out.println(max+" "+"0");
    }
}

import java.util.Scanner;
import java.util.Arrays;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
	    int n=sc.nextInt();
	    sc.nextLine();
          String s=sc.nextLine().toLowerCase();

         String[] ps =new String[255];
         int j=0;

         for(int i=0;i<n;i++)
         {
        	 if(s.charAt(i)=='(')
        	 {
        		 ps[j]="";
        		 int k=i+1;
        		 while(s.charAt(k)!=')')
        		 {
        			 ps[j]+=s.charAt(k);
        			 k++;
        		 }
        		 j++;
        	 }
         }
         long ans2=0;
         for(int i=0;i<j;i++)
         {
        	// System.out.println(ps[i]);
        	 String[] t=ps[i].split("_");
        	 int d=0;
        	 for(int p=0;p<t.length;p++)
        	 {
        		 if(t[p].equals("") || t[p].equals(" "))
        			 d++;
        	 }
        	 //System.out.println(t.length);
        	 ans2+=(t.length-d);
         }

   int ans1=0;
      String[] sp=s.split("_");
      int min=0;
      for(int i=0;i<sp.length;i++)
      {

    	  if(sp[i].contains("(") || sp[i].contains(")"))
    	  {
    	  if(sp[i].contains("("))
    	  {
    		  int m=0;
    		  while(sp[i].charAt(m)!='(')
    		  {
    			  m++;
    		  }
    		  if(m>min)
    			  min=m;
    	  }
    	  if(sp[i].contains(")"))
    	  {
    		  int m=sp[i].length()-1;
    		  int v=0;
    		  while(sp[i].charAt(m)!=')')
    		  {
    			  m--;
    			  v++;
    		  }
    		  if(v>min)
    			  min=v;
    	  }
    	  }
    	  else
    	  {
    		  if(sp[i].length()>min)
    			  min=sp[i].length();
    	  }
      }
   System.out.println(min+" "+ans2);

	}

}

import java.util.Arrays;
import java.util.Scanner;

public class Main {
public static void main(String args[]) {
	Scanner s=new Scanner(System.in);
	int n=s.nextInt();
	String inp=s.next();
	//inp=inp.replaceAll("_"," ");
	//String ss[]=inp.split("_");
	//System.out.println(Arrays.toString(ss));
//System.out.println(inp);
	int maxl=-1,curl=0;
for(int i=0;i<n;i++){
	if(inp.charAt(i)=='_'){if(curl>maxl)maxl=curl;curl=0;continue;}
	else if(inp.charAt(i)!='(' && inp.charAt(i)!=')'){curl++;}
	else{
		if(curl>maxl)maxl=curl;
		curl=0;
		i++;while(inp.charAt(i)!=')')i++;
		i++;
	}
	//if(curl>maxl)maxl=curl;
}
if(curl>maxl)maxl=curl;
int numwrd=0;curl=0;
for(int i=0;i<n;i++){
	while(i<n && inp.charAt(i)!='('){i++;}
	if(i==n)break;
	i++;
	while(inp.charAt(i)!=')'){
		if(inp.charAt(i)=='_'){if(curl>0)numwrd++;curl=0;}
		else if(inp.charAt(i)!='_'){curl++;}
		i++;
	}
	if(curl>0)numwrd++;
}

System.out.println(maxl+" "+numwrd);

}
}

import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n;
		String s;
		n = sc.nextInt();
		s = sc.next();
		boolean openParathensis = false ;
		StringBuilder sb = new StringBuilder();
		int maxOutSide = 0;
		int nbrInside = 0;
		for(int i = 0 ; i<n;i++){
			if(s.charAt(i) == '('){
				if(!openParathensis){
					String[] outsideWords = sb.toString().split("_");
					for(String o : outsideWords){
						maxOutSide = Math.max(maxOutSide,o.length());
					}
				}
				openParathensis = true;
				sb = new StringBuilder();
			}
			else if(s.charAt(i) == ')'){
				openParathensis = false;
				String[] inside = sb.toString().split("_");
				nbrInside+=inside.length;
				sb = new StringBuilder();
			}else{
				sb.append(s.charAt(i));
			}
		}
		System.out.println(maxOutSide+" "+nbrInside);
	}
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;

public class TextRed {
    public static void main(String[] args) {
        try {
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
            int len = Integer.parseInt(reader.readLine());
            String s = reader.readLine();
            reader.close();

            int lenverb = 0;
            int verbCount = 0;

            int x = 0;
            ArrayList<Integer> list = new ArrayList<Integer>();
            boolean inScob = false;
            char[] array = s.toCharArray();
            list.add(0);
            for (char c : array) {
                if (c == '(') {
                    inScob = true;
                    if (x != 0) {
                        list.add(x);
                    }
                    x = 0;
                    continue;
                } else if (c == ')') {
                    inScob = false;
                    continue;
                }

                if (inScob == false && c != '_') {
                    x++;
                } else if (inScob == false && c == '_') {
                    list.add(x);
                    x = 0;
                }
            }

            System.out.print(Collections.max(list) + " ");

            x = 0;
            inScob = false;
            for (char c:array)
            {
                if (c == '(') {
                  inScob = true;
                    x = 0;
                    continue;
                } else if (c == ')') {
                   inScob = false;
                    if (x != 0)
                    {
                        verbCount++;
                    }
                    x = 0;
                    continue;
                }

                if (inScob && c != '_' )
                {
                    x++;
                }else if (inScob && c == '_')
                {
                    if (x != 0)
                    {
                        verbCount++;
                    }
                    x = 0;
                }
            }

            System.out.print(verbCount);
        }catch (Exception e)
        {
            System.out.print(0 + " " + 0);
        }
    }
}

import java.io.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String s=sc.next();
		int flag1=0;
		int flag2=0;
		int flag3=0;
		int max=-1;
		int cur=0;
		int number=0;
		for(int i=0;i<n;i++){
			if(flag1==1){
				if(isAlpha(s.charAt(i))){
					cur++;
				}
				else
				{
					max=Math.max(max, cur);
					cur=0;
					flag1=0;
				}
			}
			if(flag2==1){
				if(isAlpha(s.charAt(i))){
					flag3=1;
				}
				if(s.charAt(i)==')'){
					flag2=0;
				}
				if(flag3==1){
					if(s.charAt(i)=='_'){
						flag3=0;
						number++;
					}
					if(s.charAt(i)==')'){
						flag3=0;
						flag2=0;
						number++;
					}
				}

			}
			if(s.charAt(i)=='_'){
				flag1=1;
			}
			if(s.charAt(i)=='('){
				flag2=1;
				flag1=0;
			}

		}
		if(max==-1){
			System.out.print(0+" ");
		}
		else
		System.out.print(max+" ");
		System.out.println(number);
	}
static boolean isAlpha(char a){
	if((a>='A'&&a<='Z')||(a>='a'&&a<='z')){
		return true;
	}
	else
		return false;
}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.stream.Stream;
import java.util.StringTokenizer;
import java.util.regex.Pattern;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String input = in.next();
            String pattern = "\\([\\w_]+\\)";
            String[] outSite = input.split(pattern);
            int longest = 0;
            for (String s : outSite) {
                longest = Math.max(longest, longestWords(s));
            }
            Pattern r = Pattern.compile(pattern);
            Matcher m = r.matcher(input);
            long numberInside = 0;
            while (m.find()) {
                numberInside += Arrays.stream(trimParentheses(m.group()).split("_")).filter(s -> !s.isEmpty()).count();
            }
            out.println(longest + " " + numberInside);
        }

        private int longestWords(String line) {
            String[] words = line.split("_");
            int result = 0;
            for (String word : words) {
                result = Math.max(result, word.length());
            }
            return result;
        }

        private String trimParentheses(String input) {
            String temp = input.substring(1, input.length());
            return temp.substring(0, temp.length() - 1);
        }

    }

    static class InputReader {
        private StringTokenizer tokenizer;
        private BufferedReader reader;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.Scanner;
import java.util.Arrays;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
	    int n=sc.nextInt();
	    sc.nextLine();
          String s=sc.nextLine().toLowerCase();

         String[] ps =new String[255];
         int j=0;

         for(int i=0;i<n;i++)
         {
        	 if(s.charAt(i)=='(')
        	 {
        		 ps[j]="";
        		 int k=i+1;
        		 while(s.charAt(k)!=')')
        		 {
        			 ps[j]+=s.charAt(k);
        			 k++;
        		 }
        		 j++;
        	 }
         }
         long ans2=0;
         for(int i=0;i<j;i++)
         {
        	// System.out.println(ps[i]);
        	 String[] t=ps[i].split("_");
        	 int d=0;
        	 for(int p=0;p<t.length;p++)
        	 {
        		 if(t[p].equals("") || t[p].equals(" "))
        			 d++;
        	 }
        	 //System.out.println(t.length);
        	 ans2+=(t.length-d);
         }

   int ans1=0;
      String[] sp=s.split("_");
      int min=0;
      for(int i=0;i<sp.length;i++)
      {
    	  if(sp[i].contains("(") || sp[i].contains(")"))
    			  continue;
    	  else
    	  {
    		  if(sp[i].length()>min)
    			  min=sp[i].length();
    	  }
      }
   System.out.println(min+" "+ans2);

	}

}

import java.util.Scanner;

public class CodeForces
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		scan.next();
		String s = scan.next();
		String[] out = s.replaceAll("\\([^)]*\\)", " ").replaceAll("_", " ").trim().split(" +");
		int a = 0;
		for (int i = 0; i < out.length; i++)
			a = Math.max(a, out[i].length());
		int b = s.replaceAll("(^|\\))[^(]*(\\(|$)", " ").replaceAll("_", " ").trim().split(" +").length;
		System.out.println(a+" "+b);
	}
}

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();

		int insideBrackets = 0;
		int countNoInside = 0, countMax = 0, wordSize = 0;

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

			char c = s.charAt(i);

			if(c!='(' && c!=')' && c!='_')
				wordSize++;
			if(c == '('){
				if(insideBrackets>0){
					countNoInside++;
					wordSize = 0;
				}

				insideBrackets++;
			}

			if(c == ')'){
				insideBrackets--;
				if(wordSize>0){
					countNoInside++;
					wordSize = 0;
				}

			}
			if(c == '_'){
				if(insideBrackets>0 && wordSize>0)
					countNoInside++;
				else if(c == '_' && insideBrackets<=0)
					countMax = Math.max(countMax, wordSize);
				wordSize = 0;
			}

		}
		System.out.println(countMax + " " + countNoInside);

	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public Scanner(FileReader r){	br = new BufferedReader(r);}

		public String next() throws IOException
		{
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {return Integer.parseInt(next());}

		public long nextLong() throws IOException {return Long.parseLong(next());}

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException { return Double.parseDouble(next()); }

		public boolean ready() throws IOException {return br.ready();}

	}

}

import java.util.Scanner;

public class Test {

public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        String s = in.next();
        int max_cnt = 0 , cnt = 0,words = 0;
        boolean is_p = false ;
        for(int i = 0 ; i < n ; i++){
            if(s.charAt(i)=='(') is_p = true;
            else if (s.charAt(i)==')') is_p = false;
            else if(((s.charAt(i)>='a'&&s.charAt(i)<='z')||(s.charAt(i)>='A'&&s.charAt(i)<='Z'))&&!is_p) cnt++;
            else if(((s.charAt(i)>='a'&&s.charAt(i)<='z')||(s.charAt(i)>='A'&&s.charAt(i)<='Z'))&&is_p){
                words++;
                while(((s.charAt(i)>='a'&&s.charAt(i)<='z')||(s.charAt(i)>='A'&&s.charAt(i)<='Z'))&&i<n) i++;
                i--;
            }
            else{
                if(cnt>max_cnt) max_cnt = cnt;
                cnt = 0;
            }
        }
        System.out.println(max_cnt+" "+words);

    }

}

import java.util.InputMismatchException;

import java.io.IOException;
import java.io.PrintWriter;

public class B_375 {

	/**************Scanner********************/
	static class FastReader {
		private byte[] buf = new byte[1024];
		private int curChar;
		private int snumChars;

		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = System.in.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n) {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextInt();
			}
			return arr;
		}

		public long[] nextLongArray(int n) {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLong();
			}
			return arr;
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
	}

	/************main*************/
	public static void main(String args[]) {

		FastReader scan = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		/*******************code***********************/
		int n=scan.nextInt();
		String s=scan.nextLine();
		int flag=0;
		int max=0;
		int word=0;
		int count=0;
		for(int i=0;i<s.length();i++)
		{
			if(n-1==i)
			{
				if(count!=0&&flag==0)
				{
					if(count+1>max)
					{
						max=count+1;
					}
				}
			}
			if(s.charAt(i)=='_')
			{
				if(count!=0&&flag==1)
				{
					word++;
					count=0;
				}
				if(count!=0&&flag==0)
				{
					if(count>max)
					{
						max=count;
					}
					count=0;
				}

			}
			else if(s.charAt(i)=='(')
			{
				if(count!=0)
				{
					if(count>max)
					{
						max=count;
					}
					count=0;
				}
				flag=1;
			}
			else if(s.charAt(i)==')')
			{
				if(count!=0)
				{
					word++;
					count=0;
				}
				flag=0;
			}
			else
			{
				count++;
			}
		}
		out.println(max+" "+word);
		out.close();

	}
}

import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        Solver s = new Solver();
        s.solve(in, out);
        out.close();
    }
    static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            int n = in.nextInt();
            String s = in.next();
            int winpars = 0, longest = 0;
            int i = 0, j = 0;
            while (s.contains("__"))
                s = s.replaceAll("__", "_");
            n = s.length();
            if (s.charAt(i) == '(') {
                while (j < n && s.charAt(j++) != ')')
                if (s.charAt(j) == ')') {
                    String temp = s.substring(i + 1, j);
                    if (!temp.contains("_") && temp.length() > 0)
                        ++winpars;
                    else {
                        StringTokenizer tok = new StringTokenizer(temp, "_");
                        winpars += tok.countTokens();
                    }
                    i = j;
                }
            }
            while (i < n && s.charAt(i) != '(') {
                ++i;
                if (i < n && s.charAt(i) == '(') {
                    j = i;
                    while (j < n && s.charAt(j++) != ')')
                    if (s.charAt(j) == ')') {
                        String temp = s.substring(i + 1, j);
                        if (!temp.contains("_") && temp.length() > 0)
                            ++winpars;
                        else {
                            StringTokenizer tok = new StringTokenizer(temp, "_");
                            winpars += tok.countTokens();
                        }
                        i = j;
                    }
                }
            }
            s = s.replaceAll("\\(.+?\\)", "_");
            s = s.replaceAll("\\(", "_");
            s = s.replaceAll("\\)", "_");
            StringTokenizer tok = new StringTokenizer(s, "_");
            while (tok.hasMoreElements()) {
                String temp = tok.nextToken();
                if (temp.length() > longest)
                    longest = temp.length();
            }
            out.println(longest + " " + winpars);
        }
    }
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

import org.omg.Messaging.SYNC_WITH_TRANSPORT;

public class prB {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA
    {
        public void solve(int testNumber, InputReader in, PrintWriter out)
        {
            int a=in.nextInt();
            String s=in.next();
            int maxl=0;
            int c=0;
            int count1=0;
            int length=0;
            int arr[]=new int[a];
            for(int i=0;i<a;i++)
            {
            	arr[i]=(int)s.charAt(i);
            }
            for(int i=0;i<a;i++)
            {
            	if(arr[i]==40)
            	{
            		while(arr[i]!=41)
            		{
            			i++;
            			if(arr[i]!=95&arr[i]!=41)
            			{
            				count1++;
            				while(arr[i]!=95&arr[i]!=41)
            				{
            					i++;
            				}
            			}
            		}
            	}

            	else if(arr[i]!=95)
            	{
            		length++;
            	}
            	else
            	{

            		if(length>maxl)
            		{
            			maxl=length;

            		}
            		length=0;
            	}
            }

            System.out.print(maxl+" ");
            System.out.print(count1);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.Scanner;

/**
 * Created by Sersh on 03.10.2016.
 */
public class lilu {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        if(n==0){
            System.out.print("0 0");
            System.exit(1);
        }
        int max_size = 0;
        int num_words = 0;
        int max_size1 = 0;
        int k = -1;
        int tmp_size = 0;
        int tmp_size1 = 0;
        boolean scob = false;
        String str = in.next();
        char [] arr = str.toCharArray();
        for(int i=0; i<n;i++){
            if(arr[i]=='(') {
                scob = true;
                k=1;
                if(tmp_size1!=0){
                    max_size = Math.max(max_size,tmp_size1);
                    tmp_size1 = 0;
                }
                if(arr[i+1]!='_' && arr[i+1]!=')')
                    num_words++;
            }
            if(arr[i]==')') {
                scob = false;
                if(arr[i-1]!='_' && arr[i-1]!='(')
                    if(k==-1 || (i>3 && arr[i-2]=='_' && arr[i-3]=='_'))
                        num_words++;

                k=-1;
            }
            if(scob){
                if(arr[i]=='_' && arr[i-1]!='_'){
                    if(arr[i-1]!='(' && arr[i+1]!=')') {
                        num_words++;
                        k=1;
                    }
                }
            }
            else{
                if(arr[i]!='_' && arr[i]!=')' && arr[i]!='('){
                    tmp_size1++;
                    if(i==(n-1)){
                        max_size = Math.max(max_size, tmp_size1);
                    }
                }else{
                    if(tmp_size1!=0) {
                        max_size = Math.max(max_size, tmp_size1);
                        tmp_size1 = 0;
                    }
                }
            }
        }

        System.out.println(max_size+" "+num_words);
    }
}

import java.io.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String s=sc.next();
		int flag1=0;
		int flag2=0;
		int flag3=0;
		int max=-1;
		int cur=0;
		int cur2=0;
		int number=0;
		boolean start=false;
		for(int i=0;i<n;i++){
			if(s.charAt(i)=='('){
				flag2=1;
			}
			if(flag2==0){
				if(s.charAt(i)=='_'&&start==false){
					start=true;
				}
				if(start==true){
				if(isAlpha(s.charAt(i))){
					cur++;
					//System.out.println(cur);
				}
				if(cur>0&&s.charAt(i)=='_'){
					max=Math.max(max, cur);
					cur=0;
					start=false;
				}
				if(cur>0&&s.charAt(i)=='('){
					max=Math.max(max, cur);
					cur=0;
					start=false;
				}

				}
			}
		    if(flag2==1){
		    	if(isAlpha(s.charAt(i))){
		    		cur2++;
		    	}
		    	if(s.charAt(i)=='_'||s.charAt(i)==')'){
		    		if(cur2>0){
		    			number++;
		    			cur2=0;
		    		}
		    	if(s.charAt(i)==')'){
		    		flag2=0;
		    	}
		    	}
		    }

		}
		if(max==-1){
			System.out.print(0+" ");
		}
		else
		System.out.print(max+" ");
		System.out.println(number);
	}
static boolean isAlpha(char a){
	if((a>='A'&&a<='Z')||(a>='a'&&a<='z')){
		return true;
	}
	else
		return false;
}
}

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

import org.omg.Messaging.SYNC_WITH_TRANSPORT;

public class prB {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA
    {
        public void solve(int testNumber, InputReader in, PrintWriter out)
        {
            int a=in.nextInt();
            String s=in.next();
            int maxl=1;
            int c=0;
            int count1=0;
            int length=0;
            int arr[]=new int[a];
            for(int i=0;i<a;i++)
            {
            	arr[i]=(int)s.charAt(i);
            }
            for(int i=0;i<a;i++)
            {
            	if(arr[i]==40)
            	{
            		while(arr[i]!=41)
            		{
            			i++;
            			if(arr[i]!=95&arr[i]!=41)
            			{
            				count1++;
            				while(arr[i]!=95&arr[i]!=41)
            				{
            					i++;
            				}
            			}
            		}
            	}

            	else if(arr[i]!=95)
            	{
            		length++;
            	}
            	else
            	{

            		if(length>maxl)
            		{
            			maxl=length;

            		}
            		length=0;
            	}
            }

            System.out.print(maxl+" ");
            System.out.print(count1);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class SolutionD
{
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int c=0;
        String str=br.readLine();
        for(int i=0;i<n;i++)
        {
            if(str.charAt(i)=='(')
            {
                if(str.charAt(i+1)!='_')
                c=c+1;
                while(str.charAt(i)!=')')
                {
                    i=i+1;
                    if(str.charAt(i)=='_')
                    {
                        while(str.charAt(i)=='_')
                            i=i+1;
                        if(str.charAt(i)!=')')
                        c=c+1;
                    }
                }
            }
        }
        String s1[]=str.split("_");
        String v="";
        for(int i=0;i<s1.length;i++)
            v=v+s1[i]+" ";
        StringBuilder sb=new StringBuilder();
        for(int i=0;i<v.length();i++)
        {
            if(v.charAt(i)=='(')
                while(v.charAt(i)!=')')
                {

                    i=i+1;
                }
            else
                sb.append(v.charAt(i));
        }
        String s2[]=sb.toString().split(" ");
        int max=0;
        for(int i=0;i<s2.length;i++)
        {
            if(s2[i].length()>max)
                max=s2[i].length();
        }
        System.out.print(max+" ");
        System.out.println(c);

    }
}

  import java.util.Scanner;

    public class JavaApplication1 {

    public static void main(String[] args)
    {

        Scanner sc=new Scanner(System.in);
        String s,ss="";int i,flag=0,max=0;
        s=sc.nextLine();
        s=sc.nextLine();
        for(i=0;i<s.length();i++)
        {
            if(s.charAt(i) == '(')
                flag=1;
            else if(s.charAt(i) == ')')
            {
                ss+="_";
                flag=0;
            }
            else if(flag == 1)
                ss+=s.charAt(i);
        }
        for(i=0;i<s.length();i++)
            if(s.charAt(i) == ')')
                s=s.substring(0,s.indexOf("("))+"_"+s.substring(i+1);
            else if(s.charAt(i) == ')' && i == s.length()-1)
                s=s.substring(0,s.indexOf("("));
        s=s.replaceAll("_+", " ").trim();
        ss=ss.replaceAll("_+"," ").trim();
        String []out=s.split(" ");
        String []in=ss.split(" ");
        for(i=0;i<out.length;i++)
            if(out[i].length() > max)
                max=out[i].length();
        if(!ss.equals("") && !ss.equals(" "))
            System.out.println(max+" "+in.length);
        else
            System.out.println(max+" "+"0");
    }
}

import java.util.*;
import java.math.*;
import java.io.*;

public class rnd375_B {
 static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
                return "";
            }
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
static class P implements Comparable{

        private int x, y;

        public P(int x, int y) {
            this.x = x;
            this.y = y;
        }

        public int hashCode() {
            return (x * 31) ^ y;
        }

        public boolean equals(Object o) {
            if (o instanceof P) {
                P other = (P) o;
                return (x == other.x && y == other.y);
            }
            return false;
        }
        public int compareTo(Object obj) {
		P l = (P) obj;
		if (this.x == l.x){
			if (this.y == l.y) return 0;
			return (this.y < l.y)? -1: 1;
		}
		return (this.x < l.x)? -1: 1;
	}
    }

public static void main(String[] args){

    FastScanner s = new FastScanner(System.in);
    StringBuilder op=new StringBuilder();
    int n=s.nextInt();
    String ip=s.next();
    int mwl=0;
    int wc=0;
    for (int i=0;i<ip.length();){
        if(ip.charAt(i)=='('){
            i++;
            int l=0;
            while(i<ip.length()){
                if(ip.charAt(i)==')'){
                    if(ip.charAt(i-1)!='('&& ip.charAt(i-1)!='_')wc++;
                    i++;
                    break;
                }
                else if(ip.charAt(i)=='_'){

                    if(ip.charAt(i-1)!='('&&ip.charAt(i-1)!='_')
                    wc++;
                }
                else
                    l++;

                i++;
            }
        }
        else if(ip.charAt(i)=='_')i++;
        else {
            int cl=1;
            //System.out.println(i+"-");
            i++;
            while(i<ip.length()){
                if(ip.charAt(i)=='_'||ip.charAt(i)=='(')
                {
                    mwl=Math.max(mwl,cl);

                    break;
                }
                else {
                    i++;
                    cl++;
                    mwl=Math.max(mwl,cl);
                }
            }
        }
       // System.out.println(mwl+" "+wc+" "+i);

    }
    System.out.println(mwl + " "+wc);

}

}

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
//        InputStream inputStream = new FileInputStream("sum.in");
        OutputStream outputStream = System.out;
//        OutputStream outputStream = new FileOutputStream("sum.out");

//        Path path = Paths.get(URI.create("file:///foo/bar/Main.java"));
//        System.out.print(path.getName(200));

//        Path p = Paths.get("/foo/bar/Main.java");
//        for (Path e : p) {
//            System.out.println(e);
//        }

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Answer solver = new Answer();
        solver.solve(in, out);
        out.close();
    }
}

class Answer {
    private final int INF = (int) (1e9 + 7);

    public void solve(InputReader in, PrintWriter out) throws IOException {
        int n = in.nextInt();
        String s = in.next();

        int kol2 = 0;
        String last_out = "";
        String tmp = "";
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == '(') {
                i++;
                while (s.charAt(i) != ')') {
                    if (s.charAt(i) == '_') {
                        if (s.charAt(i - 1) != '(' && s.charAt(i - 1) != '_') {
                            kol2++;
                        }
                    }
                    i++;
                }
                if (s.charAt(i - 1) != '(' && s.charAt(i - 1) != '_') {
                    kol2++;
                }
            } else if (s.charAt(i) == '_') {
                if (last_out.length() < tmp.length()) {
                    last_out = tmp;
                }
                tmp = "";
            } else {
                tmp += s.charAt(i);
            }
        }
        if (last_out.length() < tmp.length()) {
            last_out = tmp;
        }
        out.println(last_out.length() + " " + kol2);
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }
}

/*
 * Remember a 6.0 student can know more than a 10.0 student.
 * Grades don't determine intelligence, they test obedience.
 * I Never Give Up.
 * I will become Candidate Master.
 * I will defeat Saurabh Anand.
 * Skills are Cheap,Passion is Priceless.
 */
import java.util.*;
import java.util.Map.Entry;
import java.io.*;

import static java.lang.System.out;
import static java.util.Arrays.*;
import static java.lang.Math.*;
public class ContestMain {
	private static Reader in=new Reader();
	private static StringBuilder ans=new StringBuilder();
	private static long MOD=1000000000+7;//10^9+7
	private static final int N=100000+7; //10^5+7
//	private static final double EPS=1e-9;
//	private static final int LIM=26;
//	private static final double PI=3.1415;
	private static ArrayList<Integer> v[]=new ArrayList[N];
//	private static int color[]=new int[N];
	private static boolean mark[]=new boolean[200000+7];
//	private static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//	private static ArrayList<Pair> v[]=new ArrayList[N];
	private static long powmod(long x,long n){
		if(n==0||x==0)return 1;
		else if(n%2==0)return(powmod((x*x)%MOD,n/2));
		else return (x*(powmod((x*x)%MOD,(n-1)/2)))%MOD;
	}
	private static void shuffle(long [] arr) {
		for (int i = arr.length - 1; i >= 2; i--) {
			int x = new Random().nextInt(i - 1);
	        long temp = arr[x];
	        arr[x] = arr[i];
	        arr[i] = temp;
	    }
	 }
//	private static long gcd(long a, long b){
//		if(b==0)return a;
//		return gcd(b,a%b);
//	}
//	private static boolean check(int x,int y){
//		if((x>=0&&x<n)&&(y>=0&&y<m)&&mat[x][y]!='X'&&!visited[x][y])return true;
//		return false;
//	}
//	static class Node{
//		int left;
//		int right;
//		Node(){
//			left=0;
//			right=0;
//		}
//	}
	public static void main(String[] args) throws IOException{
		int n=in.nextInt();
		String s=in.next();
		int cout=0,cin=0,cnt=0;
		boolean flag=true;
		for(int i=0;i<n;i++){
			if(s.charAt(i)=='_'){
				if(flag){
//					out.print(i+" ");
					cout=max(cout,cnt);
					cnt=0;
				}
			}
			else if(s.charAt(i)=='('){
				flag=false;
				cout=max(cout,cnt);
				cnt=0;
			}
			else if(s.charAt(i)==')')flag=true;
			else if(flag){
//				out.print(i+" ");
				cnt++;
			}
		}
		cout=max(cnt,cout);
		cnt=0;
		flag=false;
		int word_found=0;
		for(int i=0;i<n;i++){
			if(s.charAt(i)=='(')flag=true;
			else if(s.charAt(i)=='_'){
				if(flag&&word_found==1){
					cin++;
					word_found=0;
				}
			}
			else if(s.charAt(i)==')'){
				if(word_found==1)cin++;
				flag=false;
			}
			else if(flag)word_found=1;
		}
		out.println(cout+" "+cin);
	}
	static class Pair<T> implements Comparable<Pair>{
		int l;
		int r;
		Pair(){
			l=0;
			r=0;
		}
		Pair(int k,int v){
			l=k;
			r=v;
		}
//		@Override
//		public int compareTo(Pair o) {
//			if(o.l!=l)return (int) (l-o.l);
//			else return (int)(r-o.r);
//		}
		//Fenwick tree question comparator
		@Override
		public int compareTo(Pair o) {
			if(o.r!=r)return (int) (r-o.r);
			else return (int)(l-o.l);
		}
	}
	static class Reader{
        BufferedReader br;
        StringTokenizer st;
        public Reader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {

                	st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		String str;
		String st = sc.nextLine();

		ArrayList<String> in = new ArrayList<>();
		int i =0;
		int cnt= 0;
		int j =0;
		int maxl = 0;
		while(i<st.lastIndexOf(')'))
		{

		    //if(st.indexOf('(',i)==j)
		    //j--;
		    String s = st.substring(j,st.indexOf('(',i));

		    StringTokenizer sto = new StringTokenizer(s,"_");
		    while(sto.hasMoreTokens()){
		        int l =sto.nextToken().length();
		        if(l>maxl)
		        maxl = l;
		    }
		    j = st.indexOf(')',j+1)+1;
		    String inside = st.substring(st.indexOf('(',i)+1,st.indexOf(')',i+1));

		    StringTokenizer sti = new StringTokenizer(inside,"_");
		    while(sti.hasMoreTokens()){
		        if(sti.nextToken()!="")
		        cnt++;
		    }
		    i = st.indexOf(')',i+1);

		}

		String s = st.substring(j);

	    StringTokenizer sto = new StringTokenizer(s,"_");
	    while(sto.hasMoreTokens()){
	        int l =sto.nextToken().length();
	        if(l>maxl)
	        maxl = l;
	    }
	    System.out.println(maxl+" "+cnt);
	}
}

 import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.lang.*;
public class Main{
	static long mod=1000000007;
//	static public HashMap<String,Integer> map=new HashMap<String,Integer>();
	//static public HashMap<Integer, String> map1=new HashMap<Integer,String>();

    public static void main(String[] args) throws Exception{
    	 InputReader in = new InputReader(System.in);
    	PrintWriter pw=new PrintWriter(System.out);
    int l=in.readInt();
    String s=in.readString();
  int p[]=new int[s.length()];
  int q=0;
  int r[]=new int[s.length()];
  int ss=0;
    for(int i=0;i<s.length();i++)
    {

    	if(s.charAt(i)=='('){
    	//	System.out.println(i);
    		p[q++]=i;
    	}
    	if(s.charAt(i)==')')
    		r[ss++]=i;
    }
    int sum=0;
    HashSet<Character> set=new HashSet<Character>();
    for(char c='a';c<='z';c++)
    	set.add(c);
    for(char c='A';c<='Z';c++)
    	set.add(c);
    for(int j=0;j<q;j++)
    {
    	boolean t=false;
    	String temp="";
    	int ans=0;
    	for(int i=p[j]+1;i<s.length();i++)
    	{

    		if(s.charAt(i)==')')
    			break;
    		if(set.contains(s.charAt(i))){
    		if((s.charAt(i)!='_'&&s.charAt(i+1)=='_')||(s.charAt(i)!='_'&&s.charAt(i+1)==')')){
    			ans++;
    		}
    		}

    	}
    	sum+=ans;
    }
 //   System.out.println(sum);
    ss=0;
    boolean tt=false;
    String fin="";
    for(int i=0;i<s.length();i++)
    {
    	if(!tt)
    	{
    		if(s.charAt(i)!='(')
    		fin+=s.charAt(i);
    	}
    	if(s.charAt(i)=='(')
    	{
    		tt=true;
    	}
    	if(s.charAt(i)==')')
    	{
    		tt=false;
    	}

    }
    int count=0;
    int max=0;
   // System.out.println(fin);
   for(int i=0;i<fin.length();i++)
   {
	   if(fin.charAt(i)!='_')
		   count++;
	   else
	   {
		//   System.out.println(count);
		   if(max<count)
			   max=count;
		   count=0;
	   }
   }
   System.out.println(max+" "+sum);
    }

	static class Pair implements Comparable<Pair>
	{
		int a;
		int b;
		@Override
		public int compareTo(Pair o)
		{
			if(o.b>this.b) return 1;
			if(o.b<this.b) return -1;
			return 0;
		}

	}
public static int BinarySearch(long temp,long[] sum,int r)
{
	int l=0;

	while(l<=r)
	{
		int mid=l+(r-l)/2;
		if(sum[mid]==temp&&sum[mid]!=-1)
		{
		return mid;
		}
		if(sum[mid]>temp&&sum[mid]!=-1)
			r=mid-1;
		if(sum[mid]<temp&&sum[mid]!=-1)
			l=mid+1;
    }
	return -1;
}
public static long gcd(long x,long y)
{
	if(x%y==0)
		return y;
	else
		return gcd(y,x%y);
}
public static int gcd(int x,int y)
{
	if(x%y==0)
		return y;
	else
		return gcd(y,x%y);
}
public static int abs(int a,int b)
{
	return (int)Math.abs(a-b);
}
public static long abs(long a,long b)
{
	return (long)Math.abs(a-b);
}
public static int max(int a,int b)
{
	if(a>b)
		return a;
	else
		return b;
}
public static int min(int a,int b)
{
	if(a>b)
		return b;
	else
		return a;
}
public static long max(long a,long b)
{
	if(a>b)
		return a;
	else
		return b;
}
public static long min(long a,long b)
{
	if(a>b)
		return b;
	else
		return a;
}

public static long pow(long n,long p,long m)
{
	 long  result = 1;
	  if(p==0)
	    return 1;
	if (p==1)
	    return n;
	while(p!=0)
	{
	    if(p%2==1)
	        result *= n;
	    if(result>=m)
	    result%=m;
	    p >>=1;
	    n*=n;
	    if(n>=m)
	    n%=m;
	}
	return result;
}
public static long pow(long n,long p)
{
	long  result = 1;
	  if(p==0)
	    return 1;
	if (p==1)
	    return n;
	while(p!=0)
	{
	    if(p%2==1)
	        result *= n;
	    p >>=1;
	    n*=n;
	}
	return result;

}

static long sort(int a[])
{  int n=a.length;
	int b[]=new int[n];
	return mergeSort(a,b,0,n-1);}
static long mergeSort(int a[],int b[],long left,long right)
{ long c=0;if(left<right)
 {   long mid=left+(right-left)/2;
	 c= mergeSort(a,b,left,mid);
	 c+=mergeSort(a,b,mid+1,right);
	 c+=merge(a,b,left,mid+1,right); }
	return c;	 }
static long merge(int a[],int  b[],long left,long mid,long right)
{long c=0;int i=(int)left;int j=(int)mid; int k=(int)left;
while(i<=(int)mid-1&&j<=(int)right)
{ if(a[i]<=a[j]) {b[k++]=a[i++]; }
else	{ b[k++]=a[j++];c+=mid-i;}}
while (i <= (int)mid - 1)   b[k++] = a[i++];
while (j <= (int)right) b[k++] = a[j++];
for (i=(int)left; i <= (int)right; i++)
	a[i] = b[i];  return c;  }

public static int[] radixSort(int[] f)
{
	int[] to = new int[f.length];
	{
		int[] b = new int[65537];
		for(int i = 0;i < f.length;i++)b[1+(f[i]&0xffff)]++;
		for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
		for(int i = 0;i < f.length;i++)to[b[f[i]&0xffff]++] = f[i];
		int[] d = f; f = to;to = d;
	}
	{
		int[] b = new int[65537];
		for(int i = 0;i < f.length;i++)b[1+(f[i]>>>16)]++;
		for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
		for(int i = 0;i < f.length;i++)to[b[f[i]>>>16]++] = f[i];
		int[] d = f; f = to;to = d;
	}
	return f;
}
   static  class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                } catch (IOException e)
                {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
        public double readDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, readInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
        public long readLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next()
        {
            return readString();
        }

        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }
}

import java.io.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String s=sc.next();
		int flag1=0;
		int flag2=0;
		int flag3=0;
		int max=-1;
		int cur=0;
		int cur2=0;
		int number=0;
		int js=0;
		for(int i=0;i<n;i++){
			if(s.charAt(i)=='('){
				js=1;
			}
			if(flag2==0){
				if(isAlpha(s.charAt(i))){
					cur++;
				}
				if(cur>0&&s.charAt(i)=='_'){
					max=Math.max(max, cur);
					cur=0;
				}
			}
		    if(flag2==1){
		    	if(isAlpha(s.charAt(i))){
		    		cur2++;
		    	}
		    	if(s.charAt(i)=='_'||s.charAt(i)==')'){
		    		if(cur2>0){
		    			number++;
		    			cur2=0;
		    		}
		    	if(s.charAt(i)==')'){
		    		flag2=0;
		    	}
		    	}
		    }
			if(s.charAt(i)=='('){
				flag2=1;
			}

		}
		if(cur>0){
			max=Math.max(max, cur);
			cur=0;
		}
		if(max==-1||js==0){
			System.out.print(0+" ");
		}
		else
		System.out.print(max+" ");
		System.out.println(number);
	}
static boolean isAlpha(char a){
	if((a>='A'&&a<='Z')||(a>='a'&&a<='z')){
		return true;
	}
	else
		return false;
}
}

import java.util.Scanner;

public class Prepare {

	public static void main(String[] args) {
		Scanner sc  = new Scanner(System.in);
		int a;
		a = sc.nextInt();
		String in = sc.next();
		int len = 0;
		int tmp = 0;
		int count = 0;
		boolean bl = false;
		boolean prev = false;
		for(int i = 0; i < in.length(); i++){
			if( ((96 < in.charAt(i) - 0) && (in.charAt(i) < 123)) || (in.charAt(i) > 64 && in.charAt(i) < 91)){
			if(bl && !prev)
				count++;
			if(!bl)
			len++;
			prev = true;
			}

			else if(in.charAt(i) == '_'){
				prev = false;
				if(len > tmp)
				tmp = len;
				len = 0;
				}

			else if(in.charAt(i) == '('){
				prev = false;
				bl = true;
				if(len > tmp)
					tmp = len;
				len = 0;
			}
			else if(in.charAt(i) == ')'){
				bl = false;
				prev = false;
				if(len > tmp)
					tmp = len;
				len = 0;
			}
		}
		System.out.println(tmp+" "+count);
	sc.close();
	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class TextDocumentAnalysis {
	static String s;

	public static void main(String[] args) throws NumberFormatException, IOException {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		s = sc.next();
		ArrayList<Integer> open = new ArrayList<>();
		ArrayList<Integer> closed = new ArrayList<>();
		ArrayList<Integer> und = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			if (s.charAt(i) == '(')
				open.add(i);
			else if (s.charAt(i) == ')')
				closed.add(i);
			else if (s.charAt(i) == '_')
				und.add(i);

		}
		int len = 0;
		int maxLen = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == '(') {
				i = paren(i);
				// System.out.println(wordInside);
			} else if (Character.isAlphabetic(s.charAt(i)))
				len++;
			else {
				maxLen = Math.max(maxLen, len);
				len = 0;
			}
		}
		System.out.println(maxLen + " " + wordInside);

	}

	static int wordInside;

	static int paren(int n) {
		boolean word = false;
//		System.out.println(n);
		for (int i = n;; i++) {
			if (s.charAt(i) == ')') {
				if (word)
					wordInside++;
//				System.out.println(i + " " + wordInside);
				return i;
			}
			if (Character.isAlphabetic(s.charAt(i)))
				word = true;
			if (s.charAt(i) == '_' && word) {

				wordInside++;
//				System.out.println(i + " " + wordInside);
				word = false;
			} else if (s.charAt(i) == '_')
				word = false;

		}
	}

	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}
	}
}

 import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.lang.*;
public class Main{
	static long mod=1000000007;
//	static public HashMap<String,Integer> map=new HashMap<String,Integer>();
	//static public HashMap<Integer, String> map1=new HashMap<Integer,String>();

    public static void main(String[] args) throws Exception{
    	 InputReader in = new InputReader(System.in);
    	PrintWriter pw=new PrintWriter(System.out);
    int l=in.readInt();
    String s=in.readString(); HashSet<Character> set=new HashSet<Character>();
    for(char c='a';c<='z';c++)
    	set.add(c);
    for(char c='A';c<='Z';c++)
    	set.add(c);

  int p[]=new int[s.length()];
  int q=0;
  int r[]=new int[s.length()];
  int ss=0;
  int y=0;
  for(int i=0;i<s.length();i++)
  {
	  if(!set.contains(s.charAt(i)))
		  y++;
  }
  if(y==0)
  {
	  System.out.println(s.length()+" "+0);
	  System.exit(0);
  }
    for(int i=0;i<s.length();i++)
    {

    	if(s.charAt(i)=='('){
    	//	System.out.println(i);
    		p[q++]=i;
    	}
    	if(s.charAt(i)==')')
    		r[ss++]=i;
    }
    int tt=q;
    q=-1;
    ss=-1;
    int st=p[0];

    int en=r[0];
   // System.out.println(st+" "+en);
    String out="";
    String inr="";
    for(int i=0;i<s.length();i++)
    {
    	if(s.charAt(i)=='(')
    	{
    		q++;
    		ss++;
    		st=p[q];
    		en=r[ss];
    	}
    	else if(i>=st&&i<=en)
    		{
    			inr+=s.charAt(i);
    		}
    		else
    			out+=s.charAt(i);
    }
    int count=0;
    int ans=0;

    for(int i=0;i<inr.length();i++)
    {
    	if(set.contains(inr.charAt(i)))
    	{
    		if((i+1)>=inr.length()||!set.contains(inr.charAt(i+1)))
    			ans++;
    	}
    }
   // System.out.println(ans);
 //   System.out.println(out);
    int max=0;
    for(int i=0;i<out.length();i++)
    {
    	if(set.contains(out.charAt(i)))
    	{
    		count++;
    	}
    	else
    	{
    		if(max<count)
    			max=count;
    		count=0;
    	}
    }
    if(max<count)
    	max=count;
if(tt==0)
{
	ans=0;
}
    System.out.println(max+" "+ans);
    }
//    for(int i=0;i<out.l)

	static class Pair implements Comparable<Pair>
	{
		int a;
		int b;
		@Override
		public int compareTo(Pair o)
		{
			if(o.b>this.b) return 1;
			if(o.b<this.b) return -1;
			return 0;
		}

	}
public static int BinarySearch(long temp,long[] sum,int r)
{
	int l=0;

	while(l<=r)
	{
		int mid=l+(r-l)/2;
		if(sum[mid]==temp&&sum[mid]!=-1)
		{
		return mid;
		}
		if(sum[mid]>temp&&sum[mid]!=-1)
			r=mid-1;
		if(sum[mid]<temp&&sum[mid]!=-1)
			l=mid+1;
    }
	return -1;
}
public static long gcd(long x,long y)
{
	if(x%y==0)
		return y;
	else
		return gcd(y,x%y);
}
public static int gcd(int x,int y)
{
	if(x%y==0)
		return y;
	else
		return gcd(y,x%y);
}
public static int abs(int a,int b)
{
	return (int)Math.abs(a-b);
}
public static long abs(long a,long b)
{
	return (long)Math.abs(a-b);
}
public static int max(int a,int b)
{
	if(a>b)
		return a;
	else
		return b;
}
public static int min(int a,int b)
{
	if(a>b)
		return b;
	else
		return a;
}
public static long max(long a,long b)
{
	if(a>b)
		return a;
	else
		return b;
}
public static long min(long a,long b)
{
	if(a>b)
		return b;
	else
		return a;
}

public static long pow(long n,long p,long m)
{
	 long  result = 1;
	  if(p==0)
	    return 1;
	if (p==1)
	    return n;
	while(p!=0)
	{
	    if(p%2==1)
	        result *= n;
	    if(result>=m)
	    result%=m;
	    p >>=1;
	    n*=n;
	    if(n>=m)
	    n%=m;
	}
	return result;
}
public static long pow(long n,long p)
{
	long  result = 1;
	  if(p==0)
	    return 1;
	if (p==1)
	    return n;
	while(p!=0)
	{
	    if(p%2==1)
	        result *= n;
	    p >>=1;
	    n*=n;
	}
	return result;

}

static long sort(int a[])
{  int n=a.length;
	int b[]=new int[n];
	return mergeSort(a,b,0,n-1);}
static long mergeSort(int a[],int b[],long left,long right)
{ long c=0;if(left<right)
 {   long mid=left+(right-left)/2;
	 c= mergeSort(a,b,left,mid);
	 c+=mergeSort(a,b,mid+1,right);
	 c+=merge(a,b,left,mid+1,right); }
	return c;	 }
static long merge(int a[],int  b[],long left,long mid,long right)
{long c=0;int i=(int)left;int j=(int)mid; int k=(int)left;
while(i<=(int)mid-1&&j<=(int)right)
{ if(a[i]<=a[j]) {b[k++]=a[i++]; }
else	{ b[k++]=a[j++];c+=mid-i;}}
while (i <= (int)mid - 1)   b[k++] = a[i++];
while (j <= (int)right) b[k++] = a[j++];
for (i=(int)left; i <= (int)right; i++)
	a[i] = b[i];  return c;  }

public static int[] radixSort(int[] f)
{
	int[] to = new int[f.length];
	{
		int[] b = new int[65537];
		for(int i = 0;i < f.length;i++)b[1+(f[i]&0xffff)]++;
		for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
		for(int i = 0;i < f.length;i++)to[b[f[i]&0xffff]++] = f[i];
		int[] d = f; f = to;to = d;
	}
	{
		int[] b = new int[65537];
		for(int i = 0;i < f.length;i++)b[1+(f[i]>>>16)]++;
		for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
		for(int i = 0;i < f.length;i++)to[b[f[i]>>>16]++] = f[i];
		int[] d = f; f = to;to = d;
	}
	return f;
}
   static  class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                } catch (IOException e)
                {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
        public double readDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, readInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
        public long readLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next()
        {
            return readString();
        }

        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }
}

import java.util.Scanner;

/**
 * Created by Sersh on 03.10.2016.
 */
public class lilu {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int max_size = 0;
        int num_words = 0;
        int max_size1 = 0;
        int k = -1;
        int tmp_size = 0;
        int tmp_size1 = 0;
        boolean scob = false;
        String str = in.next();
        char [] arr = str.toCharArray();
        for(int i=0; i<n;i++){
            if(arr[i]=='(') {
                scob = true;
                k=1;
                if(tmp_size1!=0){
                    max_size = Math.max(max_size,tmp_size1);
                    tmp_size1 = 0;
                }
                if(arr[i+1]!='_' && arr[i+1]!=')')
                    num_words++;
            }
            if(arr[i]==')') {
                scob = false;
                if(arr[i-1]!='_' && arr[i-1]!='(')
                    if(k==-1 || (i>3 && arr[i-2]=='_' && arr[i-3]=='_'))
                        num_words++;

                k=-1;
            }
            if(scob){
                if(arr[i]=='_' && arr[i-1]!='_'){
                    if(arr[i-1]!='(' && arr[i+1]!=')') {
                        num_words++;
                        tmp_size++;
                        k=1;
                    }
                }
            }
            else{
                if(arr[i]!='_'){
                    tmp_size1++;
                }else{
                    if(tmp_size1!=0) {
                        max_size = Math.max(max_size, tmp_size1);
                        tmp_size1 = 0;
                    }
                }
            }
        }

        System.out.println(max_size+" "+num_words);
    }
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        int n = Reader.nextInt() ;
        String s = Reader.next();
        boolean in = false , word = false , longest = false  ;
        int c = 0 , max = 0 , temp = 0;
        for (int i=0 ; i<s.length() ; i++) {
            if (s.charAt(i)=='(') {
                in = true ;

             if (longest) {
                max = Math.max(max,temp);
                temp = 0 ;
                longest=false;
                 }
                continue ;
            }else if (s.charAt(i)==')') {
                if (longest) {
                max = Math.max(max,temp);
                temp = 0 ;
                longest=false;
                 }
                if (word) {
                    c++;
                }
                in = false ;
                continue ;
            }
            if (in) {
                if (s.charAt(i)!='_') {
                    word = true ;
                }
                if (s.charAt(i)=='_'&&word) {
                    word = false ;
                    c++;
                }
            } else {
                if (s.charAt(i)!='_') {
                    temp++;
                    longest=true;
                } else {
                    longest=false;
                    max = Math.max(temp,max);
                    temp = 0 ;
                }
            }
        }
        if (longest) {
            max = Math.max(max,temp);
        }
        System.out.println(max+" "+c);

    }

}
class Pair {
    int x ;
    int y ;

    Pair (int x , int y) {
        this.x = x ;
        this.y = y ;
    }
}
class Reader {

        static BufferedReader reader;
        static StringTokenizer tokenizer;

        public static int pars(String x) {
            int num = 0;
            int i = 0;
            if (x.charAt(0) == '-') {
                i = 1;
            }
            for (; i < x.length(); i++) {
                num = num * 10 + (x.charAt(i) - '0');
            }

            if (x.charAt(0) == '-') {
                return -num;
            }

            return num;
        }

        static void init(InputStream input) {
            reader = new BufferedReader(
                    new InputStreamReader(input));
            tokenizer = new StringTokenizer("");
        }

        static void init(FileReader input) {
            reader = new BufferedReader(input);
            tokenizer = new StringTokenizer("");
        }

        static String next() throws IOException {
            while (!tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(
                        reader.readLine());
            }
            return tokenizer.nextToken();
        }

        static int nextInt() throws IOException {
            return pars(next());
        }

        static long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        static double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }

import java.io.*;
import java.util.*;
public class TextEditing{
    public static int maxLength(String s){
        String t="";
        boolean f=false;
        char ch;
        for(int i=0;i<s.length();i++){
            ch=s.charAt(i);
            if(ch=='(')
                f=true;
            else if(ch==')')
                f=false;
            if(!f && ch!=')')
                t+=ch;
        }
        String arr[]=t.split("_");
        int max=0;
        for(int i=0;i<arr.length;i++)
            max=Math.max(max,arr[i].length());
        return max;
    }
    public static int count(String s){
        String arr[]=s.split("_");
        int m=0;
        for(int i=0;i<arr.length;i++){
            if(arr[i].length()!=0)
                m++;
        }
        return m;
    }
    public static int words(String s){
        int c=0;
        String t="";
        boolean f=false;
        for(int i=0;i<s.length();i++){
            char ch=s.charAt(i);
            if(ch=='(')
                f=true;
            else if(ch==')'){
                f=false;
                c+=count(t);
                t="";
            }
            if(f && ch!='(')
                t+=ch;
        }
        return c;
    }
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String s=sc.next();
        System.out.println(maxLength(s)+" "+words(s));
    }
}

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class AK375 {
	public static Scanner cin = new Scanner(System.in);
	public String ak375(int n,String str){
		String[] arr=null;
		int i=0;
		int res1=0;
		int res2=0;
		StringBuffer tmpstr2 = new StringBuffer();
		StringBuffer tmpstr1 = new StringBuffer();

		for(i=0;i<n;i++){
			if(str.charAt(i)=='('){
				tmpstr2.append("_");
				while(str.charAt(i+1)!=')'){
//					System.out.println(str.charAt(i+1));
					tmpstr2.append(str.charAt(i+1));
					i++;
				}
			}else if(str.charAt(i)!=')'){
				tmpstr1.append(str.charAt(i));
			}
		}
		String[] tmparrstr2=tmpstr2.toString().split("_");
		List arrstr2=new ArrayList();
		for(int k=0;k<tmparrstr2.length;k++){
			if(tmparrstr2[k]!=null && !tmparrstr2[k].equals("")){
				arrstr2.add(tmparrstr2[k]);
			}
		}
	//	System.out.println("tmpstr2:"+tmpstr2.toString());
		res2=arrstr2.size();
		String[] arrstr1=tmpstr1.toString().split("_");
	//	System.out.println("tmpstr1:"+tmpstr1.toString());
		for(int j=0;j<arrstr1.length;j++){
			if(arrstr1[j].length()>res1){
				res1=arrstr1[j].length();
			}
			j++;
		}
		return res1+"  "+res2;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		while (cin.hasNext()) {
			int n = cin.nextInt();
			String str = cin.next();
        long st=System.currentTimeMillis();
        //String res=new AK375().ak375(27,"(LoooonG)__shOrt__(LoooonG)");
		String res=new AK375().ak375(n, str);
        long et=System.currentTimeMillis();
    //    System.out.println("time:"+(et-st));

        System.out.println(res);

		}
	}

}

 import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.lang.*;
public class Main{
	static long mod=1000000007;
//	static public HashMap<String,Integer> map=new HashMap<String,Integer>();
	//static public HashMap<Integer, String> map1=new HashMap<Integer,String>();

    public static void main(String[] args) throws Exception{
    	 InputReader in = new InputReader(System.in);
    	PrintWriter pw=new PrintWriter(System.out);
    int l=in.readInt();
    String s=in.readString();
  int p[]=new int[s.length()];
  int q=0;
  int r[]=new int[s.length()];
  int ss=0;
    for(int i=0;i<s.length();i++)
    {

    	if(s.charAt(i)=='('){
    	//	System.out.println(i);
    		p[q++]=i;
    	}
    	if(s.charAt(i)==')')
    		r[ss++]=i;
    }
    int sum=0;
    for(int j=0;j<q;j++)
    {
    	boolean t=false;
    	String temp="";
    	int ans=0;
    	for(int i=p[j]+1;i<s.length();i++)
    	{

    		if(s.charAt(i)==')')
    			break;

    		if((s.charAt(i)!='_'&&s.charAt(i+1)=='_')||(s.charAt(i)!='_'&&s.charAt(i+1)==')')){
    			ans++;
    		}

    	}
    	sum+=ans;
    }
 //   System.out.println(sum);
    ss=0;
    boolean tt=false;
    String fin="";
    for(int i=0;i<s.length();i++)
    {
    	if(!tt)
    	{
    		if(s.charAt(i)!='(')
    		fin+=s.charAt(i);
    	}
    	if(s.charAt(i)=='(')
    	{
    		tt=true;
    	}
    	if(s.charAt(i)==')')
    	{
    		tt=false;
    	}

    }
    int count=0;
    int max=0;
   // System.out.println(fin);
   for(int i=0;i<fin.length();i++)
   {
	   if(fin.charAt(i)!='_')
		   count++;
	   else
	   {
		//   System.out.println(count);
		   if(max<count)
			   max=count;
		   count=0;
	   }
   }
   System.out.println(max+" "+sum);
    }

	static class Pair implements Comparable<Pair>
	{
		int a;
		int b;
		@Override
		public int compareTo(Pair o)
		{
			if(o.b>this.b) return 1;
			if(o.b<this.b) return -1;
			return 0;
		}

	}
public static int BinarySearch(long temp,long[] sum,int r)
{
	int l=0;

	while(l<=r)
	{
		int mid=l+(r-l)/2;
		if(sum[mid]==temp&&sum[mid]!=-1)
		{
		return mid;
		}
		if(sum[mid]>temp&&sum[mid]!=-1)
			r=mid-1;
		if(sum[mid]<temp&&sum[mid]!=-1)
			l=mid+1;
    }
	return -1;
}
public static long gcd(long x,long y)
{
	if(x%y==0)
		return y;
	else
		return gcd(y,x%y);
}
public static int gcd(int x,int y)
{
	if(x%y==0)
		return y;
	else
		return gcd(y,x%y);
}
public static int abs(int a,int b)
{
	return (int)Math.abs(a-b);
}
public static long abs(long a,long b)
{
	return (long)Math.abs(a-b);
}
public static int max(int a,int b)
{
	if(a>b)
		return a;
	else
		return b;
}
public static int min(int a,int b)
{
	if(a>b)
		return b;
	else
		return a;
}
public static long max(long a,long b)
{
	if(a>b)
		return a;
	else
		return b;
}
public static long min(long a,long b)
{
	if(a>b)
		return b;
	else
		return a;
}

public static long pow(long n,long p,long m)
{
	 long  result = 1;
	  if(p==0)
	    return 1;
	if (p==1)
	    return n;
	while(p!=0)
	{
	    if(p%2==1)
	        result *= n;
	    if(result>=m)
	    result%=m;
	    p >>=1;
	    n*=n;
	    if(n>=m)
	    n%=m;
	}
	return result;
}
public static long pow(long n,long p)
{
	long  result = 1;
	  if(p==0)
	    return 1;
	if (p==1)
	    return n;
	while(p!=0)
	{
	    if(p%2==1)
	        result *= n;
	    p >>=1;
	    n*=n;
	}
	return result;

}

static long sort(int a[])
{  int n=a.length;
	int b[]=new int[n];
	return mergeSort(a,b,0,n-1);}
static long mergeSort(int a[],int b[],long left,long right)
{ long c=0;if(left<right)
 {   long mid=left+(right-left)/2;
	 c= mergeSort(a,b,left,mid);
	 c+=mergeSort(a,b,mid+1,right);
	 c+=merge(a,b,left,mid+1,right); }
	return c;	 }
static long merge(int a[],int  b[],long left,long mid,long right)
{long c=0;int i=(int)left;int j=(int)mid; int k=(int)left;
while(i<=(int)mid-1&&j<=(int)right)
{ if(a[i]<=a[j]) {b[k++]=a[i++]; }
else	{ b[k++]=a[j++];c+=mid-i;}}
while (i <= (int)mid - 1)   b[k++] = a[i++];
while (j <= (int)right) b[k++] = a[j++];
for (i=(int)left; i <= (int)right; i++)
	a[i] = b[i];  return c;  }

public static int[] radixSort(int[] f)
{
	int[] to = new int[f.length];
	{
		int[] b = new int[65537];
		for(int i = 0;i < f.length;i++)b[1+(f[i]&0xffff)]++;
		for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
		for(int i = 0;i < f.length;i++)to[b[f[i]&0xffff]++] = f[i];
		int[] d = f; f = to;to = d;
	}
	{
		int[] b = new int[65537];
		for(int i = 0;i < f.length;i++)b[1+(f[i]>>>16)]++;
		for(int i = 1;i <= 65536;i++)b[i]+=b[i-1];
		for(int i = 0;i < f.length;i++)to[b[f[i]>>>16]++] = f[i];
		int[] d = f; f = to;to = d;
	}
	return f;
}
   static  class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                } catch (IOException e)
                {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int readInt()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
        public double readDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, readInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
        public long readLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next()
        {
            return readString();
        }

        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }
}

import java.util.*;
public class B{
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		char c;

		boolean bracket = false;
		int prevInBrackets = 0, prevWord = 0, inBrackets = 0, word = 0;

		int n = scan.nextInt();
		scan.nextLine();
		String in = scan.nextLine();
		for(int i = 0; i < n; i++){

			c = in.charAt(i);

			if(c =='('){
				bracket = true;
			}
			else if(c == ')'){
				bracket = false;
			}
			else if(c == '_'){
				if(word > prevWord)
					prevWord = word;

				if(inBrackets > prevInBrackets)
					prevInBrackets = inBrackets;

				word = 0;
				inBrackets = 0;
			}
			else{
				if(bracket)
					inBrackets++;
				else
					word++;
			}
		}

		if(word > prevWord)
			prevWord = word;

		if(inBrackets > prevInBrackets)
			prevInBrackets = inBrackets;

		System.out.println(prevWord + " " + prevInBrackets);
	}
}

import java.io.*;
import java.util.*;

public class Main {
	static int mod = (int) (1e9+7);
	static InputReader in;
    static PrintWriter out;

		public static void main(String args[] )  {

			in = new InputReader(System.in);
	        out = new PrintWriter(System.out);
	        Scanner in = new Scanner (System.in);
	       int n = in.nextInt();
	      in.nextLine();
	      String s = in.next();
	      String x="";
	      int max=0;
	      int f=0;
	      int c=0;
	      if(s.charAt(0)=='(') {
	    	  	f=1;
	      }

	       for(int i=1;i<n;i++) {
	    	   	if(s.charAt(i)=='_') {

	    	   		if(x.length()>max) {
	    	   			max=x.length();
	    	   		}
	    	   		if(f==1 && x.length()!=0) {
	    	   			c++;
	    	   		}
	    	   		x="";
	    	   	}
	    	   	else if(s.charAt(i)=='(') {
	    	   		if(x.length()>max) {
	    	   			max=x.length();
	    	   		}
	    	   		f=1;
	    	   		x="";
	    	   	}
	    	   	else if(s.charAt(i)==')') {
	    	   		if(x.length()!=0) {
	    	   		c++;
	    	   		}
	    	   		f=0;
	    	   		x="";
	    	   	}
	    	   	else {
	    	   		x+=s.charAt(i);
	    	   	}

	       }
	       System.out.print(max+" "+c);
	    	   in.close();

	        out.close();
		}

		static class InputReader
	    {

	        private final InputStream stream;
	        private final byte[] buf = new byte[8192];
	        private int curChar, snumChars;
	        private SpaceCharFilter filter;

	        public InputReader(InputStream stream)
	        {
	                this.stream = stream;
	        }

	        public int snext()
	        {
	                if (snumChars == -1)
	                        throw new InputMismatchException();
	                if (curChar >= snumChars)
	                {
	                        curChar = 0;
	                        try
	                        {
	                                snumChars = stream.read(buf);
	                        } catch (IOException e)
	                        {
	                                throw new InputMismatchException();
	                        }
	                        if (snumChars <= 0)
	                                return -1;
	                }
	                return buf[curChar++];
	        }

	        public int nextInt()
	        {
	                int c = snext();
	                while (isSpaceChar(c))
	                {
	                        c = snext();
	                }
	                int sgn = 1;
	                if (c == '-')
	                {
	                        sgn = -1;
	                        c = snext();
	                }
	                int res = 0;
	                do
	                {
	                        if (c < '0' || c > '9')
	                                throw new InputMismatchException();
	                        res *= 10;
	                        res += c - '0';
	                        c = snext();
	                } while (!isSpaceChar(c));
	                return res * sgn;
	        }

	        public long nextLong()
	        {
	                int c = snext();
	                while (isSpaceChar(c))
	                {
	                        c = snext();
	                }
	                int sgn = 1;
	                if (c == '-')
	                {
	                        sgn = -1;
	                        c = snext();
	                }
	                long res = 0;
	                do
	                {
	                        if (c < '0' || c > '9')
	                                throw new InputMismatchException();
	                        res *= 10;
	                        res += c - '0';
	                        c = snext();
	                } while (!isSpaceChar(c));
	                return res * sgn;
	        }

	        public int[] nextIntArray(int n)
	        {
	                int a[] = new int[n];
	                for (int i = 0; i < n; i++)
	                {
	                        a[i] = nextInt();
	                }
	                return a;
	        }

	        public long[] nextLongArray(int n)
	        {
	                long a[] = new long[n];
	                for (int i = 0; i < n; i++)
	                {
	                        a[i] = nextLong();
	                }
	                return a;
	        }

	        public String readString()
	        {
	                int c = snext();
	                while (isSpaceChar(c))
	                {
	                        c = snext();
	                }
	                StringBuilder res = new StringBuilder();
	                do
	                {
	                        res.appendCodePoint(c);
	                        c = snext();
	                } while (!isSpaceChar(c));
	                return res.toString();
	        }

	        public String nextLine()
	        {
	                int c = snext();
	                while (isSpaceChar(c))
	                        c = snext();
	                StringBuilder res = new StringBuilder();
	                do
	                {
	                        res.appendCodePoint(c);
	                        c = snext();
	                } while (!isEndOfLine(c));
	                return res.toString();
	        }

	        public boolean isSpaceChar(int c)
	        {
	                if (filter != null)
	                        return filter.isSpaceChar(c);
	                return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	        }

	        private boolean isEndOfLine(int c)
	        {
	                return c == '\n' || c == '\r' || c == -1;
	        }

	        public interface SpaceCharFilter
	        {
	                public boolean isSpaceChar(int ch);
	        }

	    }
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        int n = Reader.nextInt() ;
        String s = Reader.next() ;
        boolean bar = false , inside = false;
        StringBuilder ss = new StringBuilder() ;
        int c = 0 , max = 0 ;
        for (int i=0 ; i<s.length() ; i++) {
            if (s.charAt(i)=='(') {
                bar = true ;
            } else if (s.charAt(i)==')') {
                bar = false ;
            } else if (s.charAt(i)!=')'&&s.charAt(i)!='('&&s.charAt(i)!='_'&&(!bar)) {
                ss.append(s.charAt(i)+"");
            } else if (s.charAt(i)=='_'&&(!bar)) {
                max = Math.max(ss.length(),max);
                ss.delete(0,ss.length()+1);
            }
        }
        boolean word = false ;
        for (int i=0 ; i<s.length() ; i++) {
            if (s.charAt(i)=='(') {
                int k = i ;
                for (int j=k+1 ; j<s.indexOf(')',k) ; j++) {
                    if (s.charAt(j)!='_') {
                        word = true ;
                    }
                    if (s.charAt(j)=='_'&&word) {
                        c++;
                        word = false ;
                    }
                    if (j==s.indexOf(')',k)-1&&word) {
                        c++;
                        word = false ;
                    }
                    i = j ;
                }
            }
        }
        System.out.println(max+" "+c);

    }

}
class Pair {
    int x ;
    int y ;

    Pair (int x , int y) {
        this.x = x ;
        this.y = y ;
    }
}
class Reader {

        static BufferedReader reader;
        static StringTokenizer tokenizer;

        public static int pars(String x) {
            int num = 0;
            int i = 0;
            if (x.charAt(0) == '-') {
                i = 1;
            }
            for (; i < x.length(); i++) {
                num = num * 10 + (x.charAt(i) - '0');
            }

            if (x.charAt(0) == '-') {
                return -num;
            }

            return num;
        }

        static void init(InputStream input) {
            reader = new BufferedReader(
                    new InputStreamReader(input));
            tokenizer = new StringTokenizer("");
        }

        static void init(FileReader input) {
            reader = new BufferedReader(input);
            tokenizer = new StringTokenizer("");
        }

        static String next() throws IOException {
            while (!tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(
                        reader.readLine());
            }
            return tokenizer.nextToken();
        }

        static int nextInt() throws IOException {
            return pars(next());
        }

        static long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        static double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
    }

import java.util.*;
import java.lang.*;
import java.io.*;

public class Code {
    public static void main(String[] args)
    {
    try {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
        String p=br.readLine().replaceAll("[(]","_(_");
        p=p.replaceAll("[)]","_)_");
       // System.out.println(p);
        char []s=p.toCharArray();
        n=s.length;
       //System.out.println(n);
        char k[]=new char[(int)n+2];
        if(s[0]!='_')
        {
           k[0]='_';
        }
        for(int i=0;i<n;i++)
        {
            k[i+1]=s[i];
        }
        if(s[n-1]!='_')
        {
           k[n+1]='_';
        }
        int max=0,total=0;
        /*for (int i=0;i<k.length ;i++ )
            System.out.print(k[i]);
            System.out.println("");*/
        for (int i=0;i<k.length ; )
        {
            int c=0;
            if(k[i]=='_' && k[i+1] !='(' && k[i+1]!=')')
            {
               // System.out.println(k[i]+" "+i);
                for (int j=i+1;j<k.length ;j++ )
                {
                    if(((k[j]>=90 && k[j]<=122) || (k[j]>=65 && k[j]<=90)) && k[j]!='_')
                    {  //System.out.println("Hi "+k[j]);
                        c++;
                        if(c>max)
                        max=c;
                    }else
                        break;
                }

            }
             int o=0;

            if(k[i]=='(')
            {
                String h="";
                for (int j=i+1;j<k.length ;j++)
                    {
                        if(k[j]!=')')
                            h+=k[j];
                        else
                            {   o=j;
                                break;

                            }

                    }
                h=h.replaceAll("_"," ");
               // System.out.println(h);
                String a[]=h.split(" ");
                for (int j=0;j<a.length ;j++)
                {
                    if(!(a[j].isEmpty()))
                      total++;
                }

                /*int u=0;
                if(k[i+1]!=')')
                {
                  for (int j=i+1;j<k.length ;)
                    {
                        int o=0;

                       if(k[i]!=')')
                       {
                          for(int x=j+1;x<k.length;x++)
                          {
                              if(k[x]!='_')
                              {
                                  o++;
                              }else
                                break;
                          }
                       }else
                            break;
                        if(o!=0)
                        {
                            //System.out.println(k[j]);
                            j+=o;
                            total++;
                            i+=j;
                        }else
                            {
                                j++;
                                i+=j;
                            }
                    }
                }*/
            }
            if(c!=0)
            {
                i+=c;
                if(o!=0)
                    i=o;
            }

            else
                {   if(o!=0)
                    i=o;
                    else
                    i++;}

        }
       // System.out.println("");
        System.out.println(max+" "+total);

    } catch(Exception e) {
    return;}
    }
}

import java.io.*;

/**
 * @author Alexander Tsupko (alexander.tsupko@outlook.com)
 *         Copyright (c) All rights reserved.
 */
public class B {
    private static class Solve {
        private static void solve(InputReader in, PrintWriter out) {
            int n1 = 0, n2 = 0;
            boolean flag = false, letter = false;

            int n = in.readInt();
            String s = in.readString();
            int length = s.length(), count = 0;
            for (int i = 0; i < length; i++) {
                if (s.charAt(i) == '(') {
                    flag = true;
                }
                if (!flag) {
                    if (s.charAt(i) != '_') {
                        count++;
                    } else {
                        n1 = Math.max(n1, count);
                        count = 0;
                    }
                } else {
                    if (s.charAt(i) == ')') {
                        flag = false;
                        if (letter) {
                            n2++;
                            letter = false;
                        }
                    } else {
                        if (s.charAt(i) == '_') {
                            if (letter) {
                                n2++;
                                letter = false;
                            }
                        } else {
                            if (s.charAt(i) != '(') {
                                letter = true;
                            }
                        }
                    }
                }
            }
            out.print(n1 + " " + n2);
        }
    }

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        Solve.solve(in, out); out.flush();
    }

    private static class InputReader {
        private final InputStream inputStream;
        private int current, size;
        private byte[] buffer = new byte[4096];

        private InputReader(InputStream inputStream) {
            this.inputStream = inputStream;
        }

        private int read() {
            try {
                if (current >= size) {
                    current = 0;
                    size = inputStream.read(buffer);
                    if (size < 0) {
                        return -1;
                    }
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return buffer[current++];
        }

        private int readInt() {
            int sign = 1, abs = 0, c;
            do {
                c = read();
            } while (isEmpty(c));
            if (c == '-') {
                sign = -1;
                c = read();
            }
            do {
                if (c < '0' || c > '9') {
                    throw new IllegalStateException();
                }
                abs = 10 * abs + (c - '0');
                c = read();
            } while (!isEmpty(c));
            return sign * abs;
        }

        private String readString() {
            StringBuilder sb = new StringBuilder();
            int c;
            do {
                c = read();
            } while (isEmpty(c));
            do {
                sb.append((char) c);
                c = read();
            } while (!isEmpty(c));
            return sb.toString();
        }

        private static boolean isEmpty(int c) {
            return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == -1;
        }
    }
}

import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        Solver s = new Solver();
        s.solve(in, out);
        out.close();
    }
    static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            int n = in.nextInt();
            String s = in.next();
            int winpars = 0, longest = 0;
            int i = 0, j = 0;
            while (s.contains("__"))
                s = s.replaceAll("__", "_");
            n = s.length();
            if (s.charAt(i) == '(') {
                while (j < n && s.charAt(j++) != ')')
                if (s.charAt(j) == ')') {
                    String temp = s.substring(i + 1, j);
                    if (!temp.contains("_") && temp.length() > 0)
                        ++winpars;
                    else {
                        StringTokenizer tok = new StringTokenizer(temp, "_");
                        winpars += tok.countTokens();
                    }
                    i = j;
                }
            }
            while (i < n && s.charAt(i) != '(') {
                ++i;
                if (i < n && s.charAt(i) == '(') {
                    j = i;
                    while (j < n && s.charAt(j++) != ')')
                    if (s.charAt(j) == ')') {
                        String temp = s.substring(i + 1, j);
                        if (!temp.contains("_") && temp.length() > 0)
                            ++winpars;
                        else {
                            StringTokenizer tok = new StringTokenizer(temp, "_");
                            winpars += tok.countTokens();
                        }
                        i = j;
                    }
                }
            }
            s = s.replaceAll("\\(.+?\\)", "_");
            s = s.replaceAll("\\(", "_");
            s = s.replaceAll("\\)", "_");
            StringTokenizer tok = new StringTokenizer(s, "_");
            while (tok.hasMoreElements()) {
                String temp = tok.nextToken();
                if (temp.length() > longest)
                    longest = temp.length();
            }
            out.println(longest + " " + winpars);
        }
    }
}

import java.util.Scanner;
import java.util.Arrays;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
	    int n=sc.nextInt();
	    sc.nextLine();
          String s=sc.nextLine().toLowerCase();

         String[] ps =new String[255];
         int j=0;

         for(int i=0;i<n;i++)
         {
        	 if(s.charAt(i)=='(')
        	 {
        		 ps[j]="";
        		 int k=i+1;
        		 while(s.charAt(k)!=')')
        		 {
        			 ps[j]+=s.charAt(k);
        			 k++;
        		 }
        		 j++;
        	 }
         }
         long ans2=0;
         for(int i=0;i<j;i++)
         {
        	// System.out.println(ps[i]);
        	 String[] t=ps[i].split("_");
        	 int d=0;
        	 for(int p=0;p<t.length;p++)
        	 {
        		 if(t[p].equals("") || t[p].equals(" "))
        			 d++;
        	 }
        	 //System.out.println(t.length);
        	 ans2+=(t.length-d);
         }

   int ans1=0;
      String[] sp=s.split("_");
      int min=0;
      for(int i=0;i<sp.length;i++)
      {

    	  if(sp[i].contains("(") || sp[i].contains(")"))
    	  {
    	  if(sp[i].contains("("))
    	  {
    		  int m=0;
    		  while(sp[i].charAt(m)!='(')
    		  {
    			  m++;
    		  }
    		  if(m>min)
    			  min=m;
    	  }
    	  if(sp[i].contains(")"))
    	  {
    		  int m=sp[i].length()-1;
    		  int v=0;
    		  while(sp[i].charAt(m)!=')')
    		  {
    			  m--;
    			  v++;
    		  }
    		  if(v>min)
    			  min=v;
    	  }
    	  }
    	  else
    	  {
    		  if(sp[i].length()>min)
    			  min=sp[i].length();
    	  }
      }
   System.out.println(min+" "+ans2);

	}

}

import java.util.*;
import java.io.*;

public class Main {

	BufferedReader in;
	StringTokenizer str = null;
	PrintWriter out;

	private String next() throws Exception{
		while (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

	private int nextInt() throws Exception{
		return Integer.parseInt(next());
	}

	private long nextLong() throws Exception{
		return Long.parseLong(next());
	}

	private double nextDouble() throws Exception{
		return Double.parseDouble(next());
	}

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		// int n = nextInt();
		char []a = next().toCharArray();
		int n = a.length;

		int count = 0;
		for(int i = 0; i < n; ++i) {
			if (a[i] == '(') {
				int j = i + 1;
				while(j < n && a[j] != ')') ++j;
				count += count(i + 1, j - 1, a);
			}
		}

		int max = 0;
		int l = 0;
		for(int i = 0; i < n; ++i) {
			if (a[i] == '(') {
				max = Math.max(max, max(l, i - 1, a));
				int j = i;
				while(j < n && a[j] != ')') ++j;
				l = j + 1;
			}
		}
		if (l == 0) {
			max = Math.max(l, n - 1);
		}

		out.println(max + " " + count);
		out.close();
	}

	private int count(int l, int r, char []a) {
		int ret = 0, c = 0;
		for(int i = l; i <= r; ++i) {
			if (a[i] == '_') {
				if (c > 0) ++ret;
				c = 0;
			} else {
				++c;
			}
		}
		if (c > 0) ++ret;
		return ret;
	}

	private int max(int l, int r, char []a) {
		int ret = 0, c = 0;
		for(int i = l; i <= r; ++i) {
			if (a[i] == '_') {
				ret = Math.max(ret, c);
				c = 0;
			} else {
				++c;
			}
		}
		ret = Math.max(ret, c);
		return ret;
	}

	public static void main(String[] args) throws Exception{
		new Main().run();
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class B {
	static int in=0;
	static int out=0;
	public static void main(String[] args) throws IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int l=Integer.parseInt(br.readLine());
		String line=br.readLine();
		 //loop and whebn paranthesis substring
		 String sub="";
		for(int i=0;i<l;i++){

			if(line.charAt(i)=='(')
			{   check(false,sub);
			    sub="";
				int oldi=i;
			   while(line.charAt(i)!=')'){
				      i++;

			 }
			   check(true,line.substring(oldi+1,i));
			   i--;

			}
			else {sub=sub+line.charAt(i);
			}
		}
		System.out.println(out+" "+in);

	}
	public static void check(boolean inside,String s ){
		if(inside){
			//System.out.println("in"+s);
			String [] arr=s.split("_");
			//System.out.println("inside"+Arrays.toString(arr));
			for(int i=0;i<arr.length;i++)
			{
				if(arr[i].length()>0)
					in++;
			}

		}
		else {
			//System.out.println("out"+s);
			int max=0;
			String [] arr=s.split("_");
			//System.out.println("outside"+Arrays.toString(arr));

			for(int i=0;i<arr.length;i++){
				if(arr[i].length()>max)
					max=arr[i].length();
			}

			if(max>out)
				out=max;
		}
	}

}

import java.io.BufferedReader;

import java.io.PrintWriter;

import java.io.InputStreamReader;

import java.io.IOException;

import java.util.StringTokenizer;

public class Main {

    static Scanner in = new Scanner();
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        boolean p = false;
        int n = in.nextInt(), max = 0, l = 0, t = 0;
        char[] c = in.next().toCharArray();
        for(int i = 0; i < n; i++) {
            switch(c[i]) {
                case '_' :
                    if(p)
                        t++;
                    else
                        max = Math.max(max, l);
                    l = 0;
                    break;
                case '(':
                    t++;
                    p = true;
                    break;
                case ')':
                    p = false;
                    l = 0;
                    break;
                default:
                    l++;
            }
        }
        out.print(max + " " + t);
        out.close();
    }

    static class Scanner {
        BufferedReader br;
        StringTokenizer st;

        public Scanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
            st = new StringTokenizer("");
        }

        public String next() throws IOException {
            if(!st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public String nextLine() throws IOException {
            while(!st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            String r = st.nextToken("\n");
            st = new StringTokenizer(br.readLine(), " ");
            return r;
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }
}

import java.util.Scanner;
import java.util.Arrays;
import java.util.Stack;

public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
	    int n=sc.nextInt();
	    sc.nextLine();
          String s=sc.nextLine().toLowerCase();

         String[] ps =new String[255];
         int j=0;

         for(int i=0;i<n;i++)
         {
        	 if(s.charAt(i)=='(')
        	 {
        		 ps[j]="";
        		 int k=i+1;
        		 while(s.charAt(k)!=')')
        		 {
        			 ps[j]+=s.charAt(k);
        			 k++;
        		 }
        		 j++;
        	 }
         }
         long ans2=0;
         for(int i=0;i<j;i++)
         {
        	// System.out.println(ps[i]);
        	 String[] t=ps[i].split("_");
        	 int d=0;
        	 for(int p=0;p<t.length;p++)
        	 {
        		 if(t[p].equals("") || t[p].equals(" "))
        			 d++;
        	 }
        	 //System.out.println(t.length);
        	 ans2+=(t.length-d);
         }

   int ans1=0;
      String[] sp=s.split("_");
      int min=0;
      for(int i=0;i<sp.length;i++)
      {
    	  if(sp[i].contains("(") || sp[i].contains(")") || sp[i].equals("") || sp[i].equals(" "))
    			  continue;
    	  else
    	  {
    		  if(sp[i].length()>min)
    			  min=sp[i].length();
    	  }
      }
   System.out.println(min+" "+ans2);
         // Stack us=new Stack();
          //Stack ps=new Stack();
          /*
          for(int i=0;i<n;i++)
          {
        	  if(s.charAt(i)=='-')
        	  {
        	   if(s.charAt(i+1)>='a' && s.charAt(i+1)<='z')
        	  {
        		  String t="";
        		  int j=i+1;
        		  while(!(s.charAt(j)>='a' && s.charAt(j)<='z'))
        		  {
        			  t+=s.charAt(j);
        			  j++;
        		  }
        		  us.push(t);
        		  i=j;
        	  }
        	   else
        		   continue;
        	  }
        	  if(s.charAt(i)=='(')
        	  {
        		  int k=i+1;
        		  while(s.charAt(k)!=')')
        		  {

        		  }
        	  }

          }*/

	}

}

import java.util.Scanner;
import java.io.*;
import java.util.*;
import java.math.*;

public class Check2
{
	static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

		short nextShort()
        {
            return Short.parseShort(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

	public static void main(String args[])
	{
		FastReader sc =new FastReader();
		int n=sc.nextInt();

		String ip=sc.next();
		char c[]=ip.toCharArray();
		int max=0;
		int max1=0;
		int flag=0;
		int count=0;
		for(int i=0;i<c.length;i++)
		{
			//int count=0;
			if((c[i]>=65 && c[i]<=90)||(c[i]>=97 && c[i]<=122))
			{
				count++;
			}
			else if(c[i]=='_' && flag==0)
			{
				if(count>max)
					max=count;
				count=0;
			}
			else if(c[i]=='(' && flag==0)
			{
				count=0;
				while(c[i]!=')' && i<c.length)
				{
					if((c[i]>=65 && c[i]<=90)||(c[i]>=97 && c[i]<=122))
					{
						if(c[i+1]=='_')
							max1++;
					}
					i++;
				}
				if(c[i-1]!='_')
					max1++;
			}
		}

		if(count>max)
			max=count;
		System.out.print(max+" "+max1);
	}
}

 /*class a implements Comparable<a>
	{
		int val;
		String name;
		a(int val,String name)
		{
			this.val=val;
			this.name=name;
		}

		public int compareTo(a a1)
		{
			if(val==a1.val)
			{
				//if(name.length()==a1.name.length())
					return name.compareTo(a1.name);
				//else
					//return name.length()<a1.name.length()?-1:1;
			}
			else if(val<a1.val)
			return 1;
			else
			return -1;
		}

	}  */

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static PrintWriter pw = new PrintWriter(System.out);

	public static void main(String[] args) throws Exception {
		int n =sc.nextInt() ;
		String s = sc.next() ;
		boolean inside  = false ;
		int counter = 0   , max = 0 ;
		for(int i = 0 ; i < n ; i ++){
			char c =s.charAt(i) ;
			if(c=='('){
				inside = true;
				counter= 0 ;
			}
			else if(c==')'){
				inside = false ;
				counter = 0;
			}
			else if(c=='_'){
				if(!inside){max = Math.max(max , counter );
				counter=0;
				}
			}else counter++ ;
		}
		max = Math.max(max , counter );
		int answer = 0 ;
		for(int i = 0 ; i <n ; i ++){
			char  c = s.charAt(i) ;
			if(c=='('){
				i++;
				boolean word = false ;
				while(true){
					if(s.charAt(i)==')'){
						if(word)answer++;
						break ;
					}
					else if(s.charAt(i)=='_'){
						if(word)answer++;
						word=false;
					}else word = true ;
					i++ ;
				}
			}
		}
		pw.println(max+" "+answer);
		pw.flush();
		pw.close();

	}

}

import java.util.Scanner;

public class Main10 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int am = scanner.nextInt();
        String zad = scanner.next();
        String s = zad;
        String skobki = "_";
        int str = -1;
        int len = s.length();

        for (int i = 0; i < len; i++) {
            char c = s.charAt(i);
            if (s.charAt(i) == '(') str = i;
            if (s.charAt(i) == ')') {
                skobki = skobki +"" + s.subSequence(str+1, i) + "_";
                s =  "" + s.subSequence(0, str) +  s.subSequence(i+1, s.length());
                len = s.length();
                i = str-1;
                str = -1;
            }
        }
        String arr [] = skobki.split("_");
        int count = 0;

        for (int i = 0; i < arr.length; i++)
            if (!arr[i].equals("")) count++;
         arr  = s.split("_");
        int max = -1;
        for (int i = 0; i < arr.length; i++)
            if (arr[i].length() > max) max = arr[i].length();
        System.out.println(max + " " + count);

    }
}

import java.util.ArrayList;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by chingizh on 10/6/16.
 * Problem 723B
 */

public class TextDocumentAnalysis {

    static int i,c=0,res;
    static int wordcount(String s) {
        char ch[]= new char[s.length()];
        for(i=0;i<s.length();i++) {
            ch[i]= s.charAt(i);
            if( ((i>0)&&(ch[i]!='_')&&(ch[i-1]=='_')) || ((ch[0]!='_')&&(i==0)) )
                c++;
        }
        return c;
    }

    public static int getLongestString(String[] array) {
        int maxLength = 0;
        String longestString = null;
        int length = 0;
        if (array.length != 0) {
            for (String s : array) {
                if (s.length() > maxLength) {
                    maxLength = s.length();
                }
            }
            length = 0;
        } else {
            length = longestString.length();
        }
        return length;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
//        int count = sc.nextInt();
        String a = sc.nextLine(), values = sc.nextLine();
        if (values.matches("\\d+") != true) {
            Matcher m = Pattern.compile("\\(([^)]+)\\)").matcher(values);
            ArrayList<String> prts = new ArrayList<>();
            while (m.find()) {
                prts.add(m.group(1)+"_");
            }
            StringBuffer pr = new StringBuffer(prts.get(0));
            for (int i=1; i<prts.size(); i++) {
                pr.append(prts.get(i));
            }
            int wordCountBetweenMoterize = wordcount(pr.toString());
            //**************************
            String uzunSoz = values;
            for (int i=0; i<prts.size(); i++) {
                if (uzunSoz.contains(prts.get(i).toString().substring(0, prts.get(i).length()-1))) {
                    uzunSoz = uzunSoz.replaceAll(prts.get(i).toString().substring(0, prts.get(i).length()-1), "");
                }
            }
            uzunSoz = uzunSoz.replaceAll("[()]", "");
            String[] longestList = uzunSoz.split("_");

            System.out.println(getLongestString(longestList)+" "+wordCountBetweenMoterize);
        } else {
            System.out.println("0 0");
        }

    }
}

//_Hello_Vasya(and_Petya)__bye_(and_OK)

import java.util.Scanner;

public class Test {
  public static void main(String[] args) {
    Scanner s = new Scanner(System.in);
    while (s.hasNextLine()) {
      s.nextLine();
      System.out.println(TextDocumentAnalysis.input(s.nextLine()));
    }
    s.close();
  }
  public static void main0(String[] args) {
    String[] ins = {
      "_Hello_Vasya(and_Petya)__bye_(and_OK)",
      "_a_(_b___c)__de_f(g_)__h__i(j_k_l)m__",
      "(LoooonG)__shOrt__(LoooonG)",
      "(___)"
    };
    for (int i=0; i<ins.length; i++) {
      String s = TextDocumentAnalysis.input(ins[i]);
      System.out.println(s);
    }
  }
}

class TextDocumentAnalysis {
  public static String input(String str) {
    int len = str.length();
    boolean open = false;
    int wc = 0;
    int max = 0;
    int wlen = 0;
    for (int i=0; i<len; i++) {
      char ch = str.charAt(i);
      if (ch == '(') {
        if (wlen > 0) {
          if (wlen > max) max = wlen;
          wlen = 0;
        }
        open = true;
      } else if (ch == ')') {
        if (wlen > 0) {
          wc++;
          wlen = 0;
        }
        open = false;
      } else if (ch == '_') {
        if (wlen > 0) {
          if (open) {
            wc++;
          } else {
            if (wlen > max) max = wlen;
          }
          wlen = 0;
        }
      } else {
        wlen++;
      }
    }
    return max + " " + wc;
  }
}

import java.util.Scanner;

public class JavaApplication4 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String l=sc.next();
        char a[]=new char[n];
        for(int i=0;i<n;i++)
        a[i]=l.charAt(i);
        int i=0,c=0,max=0,ans=0;
        boolean x=false,y=true;
        while(i<n)
        {
            if(a[i]=='(')
            {y=false;
            i++;
            max=Math.max(c, max);
            continue;}
            if (a[i]=='_')
            {
                i++;
                max=Math.max(c, max);
                c=0;
                continue;
            }
            if(a[i]==')')
            {
                i++;
                y=true;
                continue;
            }
            if(y==true)
            {c++;max=Math.max(c, max);}i++;
        }

        for(int j=0;j<n;j++)
        {
            if(a[j]=='(')
            {
                x=true;
                if(a[j+1]!='_'&&a[j+1]!=')')
                    ans++;}

            if(a[j]=='_'&&j<n-1)
                if(a[j+1]!='_'&&a[j+1]!=')'&&x==true)
                    ans++;
            if(a[j]==')')
                x=false;
        }
        System.out.println(max+" "+ans);
}
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner st=new Scanner (System.in);
		int l=st.nextInt(); char ch; String wd="";
		int max=0,num=0;
		String s=st.next();
		int i,j=0;
		for(i=0;i<l;i++)
		{
			ch=s.charAt(i);
			if(ch=='(')
			{
				wd="";
				j=1;
			}
			else if(ch==')'){
				if(wd.length()!=0)
				num++;
			j=0;
			wd="";
			}
			else if(ch=='_')
			{
				if(j==1){
				if(wd.length()!=0)
				num++;}
				else
				max=(max>wd.length())?max:wd.length();
				wd="";
			}
			else{
			wd=wd+ch;
			if(i==l-1)
			max=(max>wd.length())?max:wd.length();
			}
			}
			System.out.println(max+" "+num);
		}

		// your code goes here
	}

import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = Integer.parseInt(in.nextLine());
        String input = in.nextLine();

        String current = "";
        boolean inside = false;
        int insideCount = 0;
        int longest = 0;
        for (int i = 0; i < n; i++) {
        	char c = input.charAt(i);
        	if (c == '_' || c == '(' || c == ')') {
        		if (inside && current.length() != 0) {
        			insideCount++;
        		} else {
        			if (current.length() > longest) {
        				longest = current.length();
        			}
        		}
        		current = "";
        		if (c == '(') {
        			inside = true;
        		} else if (c == ')') {
        			inside = false;
        		}
        	} else {
        		current += c;
        	}
        }

        System.out.println(longest + " " + insideCount);
    }
}

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.SortedSet;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.util.Vector;

/**
 * Created by rakshit on 27/1/17.
 * Java is Love and Code is Beautiful..
 */
public class TextDocument {

    static class InputReader
    {
        public BufferedReader reader;
        public StringTokenizer tok;

        public InputReader(InputStream inputStream)
        {
            reader =new BufferedReader(new InputStreamReader(inputStream));
            tok=null;
        }

        public InputReader(String inputFile) throws FileNotFoundException
        {
            reader=new BufferedReader(new FileReader(inputFile));
            tok=null;
        }

        public String nextLine()
        {
            String c="";
            try
            {
                c+=reader.readLine();
            }
            catch(IOException e)
            {
                throw new RuntimeException(e);
            }

            return c;
        }

        public String next()
        {
            while(tok==null || !tok.hasMoreTokens())
            {
                try
                {
                    tok=new StringTokenizer(nextLine());
                }
                catch(Exception e)
                {
                    throw new RuntimeException(e);
                }
            }

            return tok.nextToken();
        }

        public int nextInt()
        {
            return Integer.parseInt(next());
        }

        public long nextLong()
        {
            return Long.parseLong(next());
        }

        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
    }

    public static void main(String args[])
    {
        InputStream inputstream=System.in;
        OutputStream outputstream=System.out;
        InputReader in=new InputReader(inputstream);
        PrintWriter out=new PrintWriter (outputstream);
        Task solver=new Task();
        solver.solve(in,out);
    }

    static class Task
    {
        private final int k=Integer.MAX_VALUE;
        public void solve(InputReader in , PrintWriter out)
        {
            int n=in.nextInt();
            String s=in.next();

            boolean flag=false;
            SortedSet<Integer>store=new TreeSet<>();
            int box=0;
            store.add(0);
            int l=0;
            int a=k,b=k;

            Vector<Pair>ret=new Vector<>();

            for(int i=0 ;i<n ;i++)
            {
                if(flag==false)
                {
                    if(s.charAt(i)!='_' && s.charAt(i)!='(')
                    {
                        l++;
                      //  out.print(s.charAt(i));
                    }
                    else
                    {
                    //    out.println();
                        store.add(l);
                        l=0;
                    }

                    if(s.charAt(i)=='(')
                    {
                        flag=true;
                        store.add(l);
                        l=0;
                        a=i;
                    }
                }

                if(s.charAt(i)==')')
                {
                    flag=false;
                    b=i;
                }

                if(a!=k && b!=k)
                {
                    Pair pair=new Pair(a,b);
                    ret.add(pair);
             //       out.println(pair.first()+" "+pair.second());
                    a=k;
                    b=k;
                }
            }

            l=0;

            for(int i=0 ;i<ret.size() ;i++)
            {
                for(int j=ret.elementAt(i).first()+1 ;j<ret.elementAt(i).second() ;j++)
                {
                    if(s.charAt(j)!='_')
                    {
                        l++;
               //         out.print(s.charAt(j));
                    }
                    else
                    {
              //          out.println();
                        if(l>0) {
                            box++;
                            l = 0;
                        }
                    }
                }

                if(l>0) {
                    box++;
                    l = 0;
                }
            }
            out.println(store.last() +" "+box);
            out.flush();
        }
    }

    static class Pair
    {
        int a,b;
        Pair(int a,int b)
        {
            this.a=a;
            this.b=b;
        }

        public int first()
        {
            return a;
        }

        public int second()
        {
            return b;
        }
    }
}

//package CF;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class B {
    public static void main(String[] args) throws Exception
    {
	Scanner bf = new Scanner(System.in);
	PrintWriter out = new PrintWriter(System.out);
	int n = bf.nextInt();
	String s = bf.next();
	char [] c = s.toCharArray();
	int ins = 0, lon = 0;
	int len = 0;
	for (int i = 0; i < c.length; i++)
	{
	    if(c[i] == '('){
		len = 0;
		i++;
		while(i < c.length && c[i] != ')'){
		    if(c[i] == '_'){
			if(len > 0)
			    ins++;
			len = 0;
		    }
		    else len++;
		    i++;
//		    out.println(i+" "+len+" "+ins);

		}
		if(len > 0)
		    ins++;
		len = 0;
	    }
	    else if(c[i] == '_'){
		if(len > 0)
		    lon = Math.max(lon, len);
		len = 0;
	    }
	    else len++;
//	    out.println(i+" "+len+" "+ins);
	}
	out.println(lon + " " + ins);
	out.flush();
	out.close();
    }

    static class Scanner {
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream s)
	{
	    br = new BufferedReader(new InputStreamReader(s));
	}

	public Scanner(FileReader fileReader)
	{
	    br = new BufferedReader(fileReader);
	}

	public String next() throws IOException
	{
	    while (st == null || !st.hasMoreTokens())
		st = new StringTokenizer(br.readLine());
	    return st.nextToken();
	}

	public int nextInt() throws IOException
	{
	    return Integer.parseInt(next());
	}

	public long nextLong() throws IOException
	{
	    return Long.parseLong(next());
	}

	public String nextLine() throws IOException
	{
	    return br.readLine();
	}

	public boolean ready() throws IOException
	{
	    return br.ready();
	}
    }
}

import java.io.*;
public class test
{

	public static void main(String args[])throws IOException
	{
		int len,cin=0,cout=0,j=0,i=0,c=0,n;
		char ch,ch1;
		DataInputStream d =new DataInputStream(System.in);
		n=Integer.parseInt(d.readLine());
		String str=d.readLine();
		len=n;
		str=str+"  ";
		while(i<len)
		{
			ch=str.charAt(i);
			if(ch=='(')
			{
				j=i+1;
				while((ch1=str.charAt(j)) !=')')
				{
					if(ch1 != '_')
						c++;
					else
					{
						if(c!=0)
							cin++;
						c=0;
					}
					j++;
				}
				i=j+1;
				if(c!=0)
				{
					cin++;
					c=0;
				}
			}
			else
			{
			if((ch!='_' ) &&((ch1=str.charAt(i+1))!='('))
				c++;
			else
			{
				if(c>=cout)
					cout=c;
				c=0;
			}
			i++;
			}

			}
		if(c>cout)
		{
			cout=c;
			c=0;
		}
		System.out.print(cout+" "+cin);
	}

}

import java.util.Scanner;

public class Document{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);

        int strLength = scan.nextInt();

        String str = scan.next();

        String[] insideWords = str.replaceAll("^.*\\(|\\).*\\(||\\).*$", "").split("_");

        String[]outsideWords = str.replaceAll("\\(.*\\)","").split("_");

        int longest = 0;

        for(String s : outsideWords){
            if(s.length() > longest){
                longest = s.length();
            }
        }

        System.out.println(longest + " " + insideWords.length);

    }
}

import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Scanner;

import javax.imageio.stream.FileImageInputStream;

public class easy {

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		boolean skb=false;
		String temp="";
		int max=0;
		ArrayList<String> arr=new ArrayList<>();
		Scanner in=new Scanner(System.in);
		int how=in.nextInt();
		char c;
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		while(how-->0){
			c=(char)br.read();
			if(c=='('){
				skb=true;
				if(temp.length()>max){
					max=temp.length();
				}
				temp="";
			}
			if(c==')'){
				skb=false;
				if(temp.length()>0){
					arr.add(temp);
					temp="";
				}
			}
			if(Character.isLetter(c)==true) temp+=c;
			if(c=='_' && skb==false){
				if(temp.length()>max){
					max=temp.length();
				}
				temp="";
			}
			if(c=='_' && skb==true){
				if(temp.length()>0){
					arr.add(temp);
					temp="";
				}
			}
		}
		System.out.println(max+" "+arr.size());
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class codeforces {

    public static int Binary(int x,int array[]){
        int min=0;
        int max=array.length-1;
        int mid=0;
        while(min<max){
            mid=(max+min)/2;
            if (array[mid]==x)return mid;
            if (x>array[mid])min=mid+1;
            if (x<array[mid])max=mid-1;

        }

    return 0;}

    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        int n=Reader.nextInt(),max=0,countw=0;
        String x=Reader.next();
        char ch[]=x.toCharArray();
        for (int i = 0; i < n; i++) {
            if(ch[i]!='_'&&ch[i]!='('){
            int count=0;
                for (int j = i; j < n; j++) {                    count++;

                    if(ch[j]=='_'||ch[j]=='('||j==n-1){max=Math.max(max, count);i=j;break;}
                    }

            }
            if (ch[i]=='('){int count=0;
                for (int j = i; j < n; j++) {
                                         if((ch[j]=='_'||ch[j]==')')&&count>0){countw++;count=0;}

                    if(ch[j]==')'){i=j;break;}
                     if(ch[j]!='_'&&ch[j]!='(')count++;

                }

            }

        }
        System.out.println(max+" "+countw);

    }

}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;
    static void init(InputStream input) {
        reader = new BufferedReader(new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }
    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}

import java.util.Scanner;
public class p723b{
	public static void main(String []args){
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		String s = in.next();
		int lw,wi,w,j;
		boolean _in=false;
		lw=wi=w=j=0;
		for(int i=0;i<s.length();i++){
			char c=s.charAt(i);
			if(c=='_' && !_in && lw<i-j-1){
				lw = i-j-1;
				j=i;
			}
			if(c=='_' && _in && i-j>1){
				wi++;
				j=i;
			}
			if(c=='('){
				_in = true;
				j=i;
			}
			if(c==')'){
				_in = false;
				if(i-j>1)wi++;
				j=i;
			}
		}
		System.out.println(lw+" "+wi);
	}
}

import java.util.*;
import java.io.*;
public class Text_Document_Analysis
{
	public static void main(String args[]) throws Exception
	{
		BufferedReader f=new BufferedReader(new InputStreamReader(System.in));
		// BufferedReader f=new BufferedReader(new FileReader("Text_Document_Analysis.in"));
		f.readLine();
		String temp=f.readLine();
		String[] arr1=temp.split("\\([a-zA-Z_]*\\)");
		int one=0;
		for(int x=0;x<arr1.length;x++)
		{
			String[] temparr=arr1[x].split("_+");
			for(int y=0;y<temparr.length;y++)
				one=Math.max(one,temparr[y].length());
		}
		int pos=0;
		int two=0;
		for(int x=0;x<arr1.length;x++)
		{
			if(arr1[x].length()==0) continue;
			pos+=arr1[x].length()+1;
			if(pos>=temp.length()) break;
			int start=pos;
			while(temp.charAt(pos)!=')')
				pos++;
			int end=pos;
			pos++;
			String[] temparr=temp.substring(start,end).split("_+");
			for(int y=0;y<temparr.length;y++)
				if(temparr[y].length()!=0)
					two++;
		}
		System.out.println(one+" "+two);
	}
}

import java.util.*;
import java.lang.*;
import java.io.*;

public class Code {
    public static void main(String[] args)
    {
    try {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
        String p=br.readLine().replaceAll("[(]","_(_");
        p=p.replaceAll("[)]","_)_");
       // System.out.println(p);
        char []s=p.toCharArray();
        n=s.length;
       //System.out.println(n);
        char k[]=new char[(int)n+2];
        if(s[0]!='_')
        {
           k[0]='_';
        }
        for(int i=0;i<n;i++)
        {
            k[i+1]=s[i];
        }
        if(s[n-1]!='_')
        {
           k[n+1]='_';
        }
        int max=0,total=0;
        /*for (int i=0;i<k.length ;i++ )
            System.out.print(k[i]);
            System.out.println("");*/
        for (int i=0;i<k.length ; )
        {
            int c=0;
            if(k[i]=='_' && k[i+1] !='(' && k[i+1]!=')')
            {
               // System.out.println(k[i]+" "+i);
                for (int j=i+1;j<k.length ;j++ )
                {
                    if((k[j]>=90 && k[j]<=122) || (k[j]>=65 && k[j]<=90))
                    {    c++;
                        if(c>max)
                        max=c;
                    }else
                        break;
                }

            }
             int o=0;

            if(k[i]=='(')
            {
                String h="";
                for (int j=i+1;j<k.length ;j++)
                    {
                        if(k[j]!=')')
                            h+=k[j];
                        else
                            {   o=j;
                                break;

                            }

                    }
                h=h.replaceAll("_"," ");
               // System.out.println(h);
                String a[]=h.split(" ");
                for (int j=0;j<a.length ;j++)
                {
                    if(!(a[j].isEmpty()))
                      total++;
                }

                /*int u=0;
                if(k[i+1]!=')')
                {
                  for (int j=i+1;j<k.length ;)
                    {
                        int o=0;

                       if(k[i]!=')')
                       {
                          for(int x=j+1;x<k.length;x++)
                          {
                              if(k[x]!='_')
                              {
                                  o++;
                              }else
                                break;
                          }
                       }else
                            break;
                        if(o!=0)
                        {
                            //System.out.println(k[j]);
                            j+=o;
                            total++;
                            i+=j;
                        }else
                            {
                                j++;
                                i+=j;
                            }
                    }
                }*/
            }
            if(c!=0)
            {
                i+=c;
                if(o!=0)
                    i=o;
            }

            else
                {   if(o!=0)
                    i=o;
                    else
                    i++;}

        }
       // System.out.println("");
        System.out.println(max+" "+total);

    } catch(Exception e) {
    return;}
    }
}

  import java.util.*;
            import java.math.*;
            import java.io.*;
            import java.text.DecimalFormat;
            import java.math.BigInteger;
            public class Main{
                //static int d=20;
                static long mod=1000000007 ;
                //static HashMap<String,Integer> hm=new HashMap<>();
                static ArrayList<ArrayList<Integer>> arr,arr2;
                static int size;
                //static int[] vis;
                public static void main(String[] args)  throws IOException {
                    boolean online =false;
                    String fileName = "C-large";
                    PrintWriter out;
                    if (online) {
                        s.init(new FileInputStream(new File(fileName + ".in")));
                         out= new PrintWriter(new FileWriter(fileName + "out.txt"));
                    }
                     else {
                        s.init(System.in);

                        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
                    }
                    int n=s.ni();
                    String x=s.ns();
                    int flag=0;
                    int len=0;
                    int count=0;
                    String z="";
                    int start=0;
                    for(int i=0;i<n;i++){
                        char ch=x.charAt(i);
                        if(ch=='(' || i==n-1){
                            start=1;
                            len=Math.max(len,z.length());
                            z="";
                            flag=1;
                        }
                        else if(ch==')'){
                            start=1;
                            flag=0;
                            count+=(z.length()>0?1:0);
                            z="";
                        }
                        else if(ch=='_'){
                            start=1;
                            if(flag==0)
                                len=Math.max(len,z.length());
                            else
                                count+=(z.length()>0?1:0);
                            z="";

                        }
                        else
                            z+=ch;

                    }
                    out.println(len+" "+count);
                    out.close();

                }

                public static long pow(long x,long y){
                    long ans=1;
                    while(y>0){
                        if(y%2==1)
                            ans=(ans*x);
                        x=(x*x);
                        y/=2;
                    }
                    return ans;

                }

                 static class name implements Comparable<name> {
                    String a;
                    int num;
                    public name(String x,int y){
                        a=x;
                        num=y;
                    }
                    public int compareTo(name o){
                        if (num!=o.num){
                            return o.num-num;
                        }
                        else
                            return a.compareTo(o.a);
                    }
                }
                public static class s {
                    static BufferedReader reader;
                    static StringTokenizer tokenizer;

                    /** call this method to initialize reader for InputStream */
                    static void init(InputStream input) {
                        reader = new BufferedReader(
                                    new InputStreamReader(input) );
                        tokenizer = new StringTokenizer("");
                    }

                    /** get next word */
                    static String ns() throws IOException {
                        while ( ! tokenizer.hasMoreTokens() ) {
                            //TODO add check for eof if necessary
                            tokenizer = new StringTokenizer(
                                reader.readLine() );
                        }
                        return tokenizer.nextToken();
                    }

                    static int ni() throws IOException {
                        return Integer.parseInt( ns() );
                    }

                    static double nd() throws IOException {
                        return Double.parseDouble( ns() );
                    }
                    static long nl() throws IOException {
                        return Long.parseLong( ns() );
                    }

                }
            }

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Scanner;

public class Pb {

	public static void main(String[] args) throws NumberFormatException, IOException {

	Scanner s = new Scanner(System.in);
	BufferedReader br= new BufferedReader (new InputStreamReader(System.in));
	ArrayList<String > arr = new ArrayList<>();
	ArrayList<Integer > ar = new ArrayList<>();
	int tam = Integer.parseInt(br.readLine());
	String cad= br.readLine();
	String word ="";

	int cont = 0, mayor=0;
	boolean flg= false;

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

		if(cad.charAt(i)=='('){
			flg=true;
			continue;
		}

		if(cad.charAt(i)==')' ){
			flg=false;
			if(word!=""){
				arr.add(word);
			}
			continue;

		}
		else if(flg==true && cad.charAt(i)!='_'){
			word+=cad.charAt(i);
			continue;

		}

		else if(flg== true && cad.charAt(i)=='_' && word!=""){
			arr.add(word);
			word="";
			continue;
		}

		else if(flg == false && cad.charAt(i)!='_'){
			cont++;
			continue;

		}
		else if ( flg==false && cad.charAt(i)=='_'){
			if (cont >= mayor){
				mayor=cont;
				cont=0;
			}
		}

	}

	System.out.println(mayor + " "+ arr.size());

	}

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Scanner;

public class Pb {

	public static void main(String[] args) throws NumberFormatException, IOException {

	Scanner s = new Scanner(System.in);
	BufferedReader br= new BufferedReader (new InputStreamReader(System.in));
	ArrayList<String > arr = new ArrayList<>();
	ArrayList<Integer > ar = new ArrayList<>();
	int tam = Integer.parseInt(br.readLine());
	String cad= br.readLine();
	String word ="";

	int cont = 0, mayor=0;
	boolean flg= false;

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

		if(cad.charAt(i)=='('){

			if (cont >= mayor){
				mayor=cont;
				cont=0;
			}
			flg=true;
			continue;
		}

		if(cad.charAt(i)==')' ){
			flg=false;
			if(word!=""){
				arr.add(word);
				word= "";
			}
			continue;

		}
		else if(flg==true && cad.charAt(i)!='_'){
			word+=cad.charAt(i);
			continue;

		}

		else if(flg== true && cad.charAt(i)=='_' && word!=""){
			arr.add(word);
			word="";
			continue;
		}

		else if(flg == false && cad.charAt(i)!='_'){
			cont++;
			if(i==(tam-1)){
				mayor=cont;

			}
			continue;

		}
		else if ( flg==false && cad.charAt(i)=='_'){
			if (cont >= mayor){
				mayor=cont;
				cont=0;
			}
		}

	}
	//System.out.println(arr);

	System.out.println(mayor + " "+ arr.size());

	}

}

import java.util.*;

public class Test {

	public static void main(String[] args) {
		ArrayList<String> arr1 = new ArrayList<>();
		ArrayList<String> arr2 = new ArrayList<>();
		Scanner in = new Scanner(System.in);
		int n, flag = 0;
		n = in.nextInt();
		String s = "", str = in.next();
		str += "_()";
		char[] input = new char[256];
		for (int i = 0; i < n; i++) {
			input[i] = str.charAt(i);
		}
		for (int i = 0; i < n; i++) {
			if (input[i] == '(') {
				flag = 1;
				input[i] = '^';
				continue;
			} else if (input[i] == ')') {
				flag = 0;
				arr2.add(s);
				input[i] = '^';
				s = "";
			}
			if (flag == 1) {
				s += input[i];
				input[i] = '^';
			}
		}
		s = "";
		for (int i = 0; i < n; i++) {
			if (input[i] == '^') {
				if (s.isEmpty() == true)
					continue;
				arr1.add(s);
				s = "";
			} else
				s += input[i];
		}
		int max = 0;
		int count = 0;
		for (int i = 0; i < arr1.size(); i++) {
			String temp = arr1.get(i);
			temp += "_";
			for (int j = 0; j < temp.length(); j++) {
				if (Character.isLetter(temp.charAt(j)) == true) {
					count++;
				} else if (temp.charAt(j) == '_') {
					max = Math.max(max, count);
					count = 0;
				}
			}
		}
		count = 0;
		for (int i = 0; i < arr2.size(); i++) {
			String temp = arr2.get(i);
			temp += "_";
			String m = "";
			for (int j = 0; j < temp.length(); j++) {
				if (Character.isLetter(temp.charAt(j)) == true) {
					m += temp.charAt(j);
				} else if (temp.charAt(j) == '_' && m.isEmpty() == false) {

					m = "";
					count++;
				}
			}
		}
		System.out.println(max + " " + count);
	}
}