test_Cases = int(raw_input())

sample = []
for i in range(test_Cases):
    sample.append(raw_input())

max_count_day = 0
temp_max_count_day=0
temp_count_day=0
temp_count=0
max_count=0
for k in sample:
    temp_max_count_day=0
    temp_count_day=0
    for i in k :
        if i == 'C':
            temp_count_day +=1
            temp_count +=1
            if max_count < temp_count:
                max_count = temp_count
            if temp_max_count_day < temp_count_day:
                temp_max_count_day = temp_count_day
        elif i == 'E' or 'S':
            temp_count = 0
            temp_count_day = 0
    if max_count_day <= temp_max_count_day:
        max_count_day =temp_max_count_day

                    
    
    
print max_count_day, max_count