import re
n=int(raw_input())
max1=0
s1=''
for ii in range(n):
	s=raw_input()
	s1+=s
	#print s
	x=re.split(r"[^C+]",s)
	#print x
	max1=max(len(max(x)),max1)
x=re.split(r"[^C+]",s1)
max2=len(max(x))
print max1, max2