import sys,re
n=input()
tl=""
x=0
while n>0:
    s=sys.stdin.readline().strip()
    tl=tl+s
    s=re.split(r'[SE]+',s)
    for i in s:
       if len(i)>x:
         x=len(i)
    n=n-1

y=0
f=re.split(r'[SE]+',tl)
for i in f:
	if len(i)>y:
		y=len(i)
print x,y