N = int(raw_input())

day_streak_lst = []

def streak_counter(lst):
	max_count = 1
	c = 1
	for j in range(0,len(lst)-1):
		if lst[j] == lst[j+1] and lst[j] == "C":
			c += 1
			if c > max_count:
				max_count = c
		else:
			c = 1
	if max_count == 1:
		return 0
	return max_count

total_data = ""
for i in range(N):
	
	data = raw_input()
	total_data += data
	day_streak_lst.append(streak_counter(data))
	
total_streak = streak_counter(total_data)
print max(day_streak_lst), total_streak