You are given a text of single-space separated words, consisting of small and capital Latin letters.

Volume of the word is number of capital letters in the word. Volume of the text is maximum volume of all words in the text.

Calculate the volume of the given text.


-----Input-----

The first line contains one integer number n (1 ≤ n ≤ 200) — length of the text.

The second line contains text of single-space separated words s_1, s_2, ..., s_{i}, consisting only of small and capital Latin letters.


-----Output-----

Print one integer number — volume of text.


-----Examples-----
Input
7
NonZERO

Output
5

Input
24
this is zero answer text

Output
0

Input
24
Harbour Space University

Output
1



-----Note-----

In the first example there is only one word, there are 5 capital letters in it.

In the second example all of the words contain 0 capital letters.

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
import string
n = int(input())
s = input()
words = s.split()
capcount = [sum((1 for c in val if c.isupper())) for val in words]
ans = max(capcount)
print(ans)


n = int(input())
a = input().split()
ans = 0
for i in a:
	cnt = 0
	for j in i:
		if j.isupper():
			cnt += 1
	ans = max(ans, cnt)
print(ans)


n = int(input())
array = list(map(str, input().split()))
voices = []
word_voice = 0
for w in array:
	for l in w:
		if l.isupper():
			word_voice += 1
	voices.append(word_voice)
	word_voice = 0
print(max(voices))


n = int(input())
x = list(input())
k = 0
a = []
for i in range(n):
	if x[i].isupper() == 1:
		k += 1
	elif x[i] == ' ':
		a.append(k)
		k = 0
	if i == n - 1:
		a.append(k)
print(max(a))


n = input()
l = list(input().split())
ans = 0
for i in range(len(l)):
	sum = 0
	for j in l[i]:
		if j >= 'A' and j <= 'Z':
			sum += 1
	ans = max(ans, sum)
print(ans)


def count_loud(word):
	l = 0
	for c in word:
		if c in loud_letters:
			l += 1
	return l
loud_letters = {chr(i) for i in range(65, 91)}
n = int(input())
text = list(map(str, input().split()))
ans = 0
for w in text:
	new_w = count_loud(w)
	if new_w > ans:
		ans = new_w
print(ans)


n = input()
text = list(input().split())
maxim = 0
s = 'QWERTYUIOPASDFGHJKLZXCVBNM'
for i in text:
	count = 0
	for j in i:
		if j in s:
			count += 1
	if count > maxim:
		maxim = count
print(maxim)


n = int(input())
s = input()
(t, mx) = (0, 0)
for i in s:
	if i.isupper():
		t += 1
	if i == ' ':
		if t > mx:
			mx = t
		t = 0
if t > mx:
	mx = t
print(mx)


_ = input()
s = input().split(' ')
max_count = 0
for word in s:
	count = 0
	for letter in word:
		if 'A' <= letter <= 'Z':
			count += 1
	max_count = max(count, max_count)
print(max_count)


x = int(input())
y = list(input().split(' '))
c = 0
l = []
for i in y:
	for j in i:
		if ord(j) >= 65 and ord(j) <= 90:
			c = c + 1
	l = l + [c]
	c = 0
print(max(l))


n = int(input())
s = list(input().split())
z = []
for y in range(len(s)):
	count = 0
	for x in range(len(s[y])):
		if ord(s[y][x]) < ord('a') and ord(s[y][x]) != ord(' '):
			count += 1
	z += [count]
print(max(z))


from re import findall as f
amount_of_words = int(input())
print(max((len(f('[A-Z]', w)) for w in input().split())))


input()

def count(s):
	l = len(s)
	tem = 0
	for i in range(l):
		if s[i].isupper():
			tem = tem + 1
	return tem
print(max((count(word) for word in input().split())))


int(input())
txt = input()
ch = txt.split(' ')
max = 0
for word in ch:
	c = 0
	for alp in word:
		if ord(alp) <= 90:
			c = c + 1
	if max <= c:
		max = c
print(max)


n = int(input())
a = input()
b = []
c = 0
for i in a:
	if i == ' ':
		b.append(c)
		c = 0
	elif i.isupper():
		c += 1
b.append(c)
print(max(b))


n = int(input())
tmp_string = input()
arr = tmp_string.split(' ')
result = 0
for i in arr:
	volume = 0
	for char in i:
		if char.isupper():
			volume += 1
	if volume > result:
		result = volume
print(result)


countCap = lambda s: sum((1 for c in s if c.isupper()))
input()
print(max((countCap(w) for w in input().split())))


def findVolume(word):
	return sum((1 for c in word if c.isupper()))
input()
words = input().strip().split(' ')
res = [findVolume(word) for word in words]
print(max(res))


input()
print(max((sum(map(str.isupper, s)) for s in input().split())))


n = int(input())
s = input()
a = s.split(' ')
ans = -1
for i in a:
	count = 0
	for j in i:
		if j >= 'A' and j <= 'Z':
			count += 1
	ans = max(ans, count)
print(ans)


alph = 'QWERTYUIOPASDFGHJKLZXCVBNM'
n = int(input())
s = input()
col = 0
m = 0
for i in s:
	for j in alph:
		if j == i:
			col += 1
	if i == ' ':
		if col > m:
			m = col
		col = 0
if col > m:
	m = col
print(m)


import string
n = input().strip()
maxim = -1
for st in input().split():
	count = 0
	for i in st:
		if i in string.ascii_uppercase:
			count += 1
	if count > maxim:
		maxim = count
print(maxim)


n = int(input())
lis = list(map(str, input().split()))
ans = 0
a = 0
for i in lis:
	a = 0
	for j in i:
		if j >= 'A' and j <= 'Z':
			a += 1
	ans = max(ans, a)
print(ans)


x = input()
a = list(input().split())
b = []
for j in a:
	s = 0
	c = list(j)
	for i in c:
		if i.upper() == i:
			s += 1
		b.append(s)
print(max(b))


n = int(input())
s = input()
(i, large) = (0, 0)
while i < n:
	cnt = 0
	while i < n and s[i] != ' ':
		if ord(s[i]) >= 65 and ord(s[i]) <= 90:
			cnt += 1
		i += 1
	if cnt > large:
		large = cnt
	i += 1
print(large)


import math, fractions
n = int(input())
words = [str(x) for x in input().split()]
volume = []
for y in words:
	volume.append(sum([1 for x in y if ord(x) >= ord('A') and ord(x) <= ord('Z')]))
print(max(volume))


cv = mv = 0
n = int(input())
str = input() + ' '
for i in str:
	if i.isupper():
		cv += 1
	elif i == ' ':
		if mv < cv:
			mv = cv
		cv = 0
print(mv)


n = int(input())
s = input().split()
arr = []
for i in s:
	cnt = 0
	for j in i:
		if j.isupper():
			cnt += 1
	arr.append(cnt)
print(max(arr))


n = int(input())
k = input().split()
volume = 0
maximum = []
for i in k:
	for m in i:
		if m.isupper() == True:
			volume += 1
	maximum.append(volume)
	volume = 0
print(max(maximum))


from math import *
from cmath import *
from itertools import *
from decimal import *
from fractions import *
from sys import *
from types import CodeType, new_class
n = int(input())
s = input().split()
ans = 0
for x in s:
	k = 0
	for y in x:
		k += y.isupper()
	ans = max(ans, k)
print(ans)


n = int(input())
text = input().split()
m = 0
for i in text:
	u = [l for l in i if l.isupper()]
	if len(u) > m:
		m = len(u)
print(m)


n = int(input())
l = list(map(str, input().split()))
(ans, ANS) = (0, [])
alfavit = ['Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V', 'B', 'N', 'M']
for i in range(len(l)):
	for j in range(len(l[i])):
		if l[i][j] in alfavit:
			ans += 1
	ANS.append(ans)
	ans = 0
print(max(ANS))


N = int(input())
S = input().split()
res = 0
for w in S:
	tmp = 0
	for s in w:
		if s.isupper():
			tmp += 1
	res = max(res, tmp)
print(res)


import string
input()
print(max((sum((sym in string.ascii_uppercase for sym in word)) for word in input().split())))


n = int(input())
word = input()
total = 0
maxTotal = 0
for i in range(0, n):
	if word[i].isupper():
		total += 1
	if word[i] == ' ':
		total = 0
	if total > maxTotal:
		maxTotal = total
print(maxTotal)


n = int(input())
s = input().split(' ')
M = 0
for word in s:
	c = 0
	for char in word:
		if char.isupper():
			c += 1
	M = max(c, M)
print(M)


(n, s) = (int(input()), input().split())
mx = 0
for word in s:
	temp = 0
	for i in word:
		if i.isupper():
			temp += 1
	mx = max(mx, temp)
print(mx)


combo = list(map(int, input().split()))
oracion = input()
mayusculas = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
contador = 0
lista = []
for i in oracion:
	if i in mayusculas:
		contador += 1
	elif i == ' ':
		lista.append(contador)
		contador = 0
lista.append(contador)
lista.sort(reverse=True)
print(lista[0])


class Volume:
	n = int(input())
	s = list(input())
	counter = 0
	aux = 0
	for i in range(len(s)):
		if s[i].isupper():
			counter += 1
		if (s[i] == ' ' or i == len(s) - 1) and ' ' in s:
			if aux < counter:
				aux = counter
			counter = 0
	if ' ' in s:
		x = 0
	else:
		aux = counter
	print(aux)


n = int(input())
text = input()
arr = text.split()
max = -100
for string in arr:
	count = 0
	for char in string:
		if ord(char) >= ord('A') and ord(char) <= ord('Z'):
			count += 1
	if max < count:
		max = count
print(max)


n = int(input())
a = list(input().split())
b = []
for i in range(len(a)):
	x = 0
	for j in range(len(a[i])):
		if a[i][j].isupper():
			x += 1
	b.append(x)
print(max(b))


l = int(input())
sList = input().split()
vol = 0
for i in sList:
	tempVol = 0
	for j in i:
		if j.isupper():
			tempVol += 1
	if tempVol > vol:
		vol = tempVol
print(vol)


n = int(input())
s = input().split()
mcnt = 0
for i in s:
	cnt = 0
	for j in i:
		if j.isupper():
			cnt += 1
	mcnt = max(mcnt, cnt)
print(mcnt)


n = int(input())
s = input().split()
ans = 0
for i in s:
	c = 0
	for j in i:
		if j.isupper():
			c += 1
	ans = max(ans, c)
print(ans)


input()
s = input().split()
ans = 0
for i in s:
	p = i.lower()
	cur = 0
	for k in range(len(i)):
		if i[k] != p[k]:
			cur += 1
	ans = max(ans, cur)
print(ans)


biggest = 0
g = int(input())
s = input().split()
for b in s:
	count = 0
	for i in b:
		if i == i.upper():
			count += 1
	if count > biggest:
		biggest = count
print(biggest)


n = int(input())
result = 0
for word in input().split():
	result = max([result, sum([0 if x.islower() else 1 for x in word])])
print(result)


n = int(input())
str = input()
str1 = str.split(' ')
max = 0
for i in range(0, str1.__len__()):
	r = 0
	for j in range(0, str1[i].__len__()):
		c = str1[i][j]
		if c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
			r += 1
	if max < r:
		max = r
print(max)


t = int(input())
s = input()
(count1, count2) = (0, 0)
for i in range(t):
	if s[i].isupper():
		count1 += 1
		count2 = max(count1, count2)
	if s[i] == ' ':
		count1 = 0
print(count2)


x = input()
n = input().split(' ')
ans = 0
for i in n:
	cur = 0
	for j in i:
		if j >= 'A' and j <= 'Z':
			cur += 1
	ans = max(ans, cur)
print(ans)


input()
mx = 0
for x in input().split():
	x = list(filter(lambda a: a.isupper(), list(x)))
	mx = max(mx, len(x))
print(mx)


n = int(input())
x = input()
y = x.split(' ')
d = []
for i in y:
	c = 0
	for z in i:
		if z.isupper():
			c = c + 1
	d.append(c)
print(max(d))


n = int(input())
a = input()
volume = 0
temp = 0
if a.islower():
	print(0)
else:
	for i in a:
		if i.isupper():
			temp += 1
		elif i == ' ':
			if temp >= volume:
				volume = temp
				temp = 0
			else:
				temp = 0
	if temp >= volume:
		volume = temp
		temp = 0
	print(volume)


n = int(input())
s = input()
ans = 0
for w in s.split(' '):
	t = 0
	for c in w:
		if ord('A') <= ord(c) <= ord('Z'):
			t += 1
	ans = max(ans, t)
print(ans)


non = input()
s = input().split()
l = list()
for x in range(0, len(s)):
	t = s[x]
	c = 0
	for y in range(0, len(t)):
		if ord(t[y]) >= 65 and ord(t[y]) <= 91:
			c = c + 1
	l.append(c)
l.sort()
print(l[len(l) - 1])


input()
print(max(map(lambda w: len(list(filter(str.isupper, w))), input().split(' '))))


n = int(input())
t = input()
com = 0
max = 0
l = t.split()
for i in l:
	for j in i:
		if ord(j) >= 65 and ord(j) <= 90:
			com = com + 1
	if com > max:
		max = com
	com = 0
print(max)


def find(s):
	c = 0
	for i in range(len(s)):
		T = s[i]
		if ord(T) <= 90 and ord(T) >= 65:
			c += 1
	return c
input()
s = list(input().strip().split(' '))
MAX = 0
for x in s:
	T = find(x)
	if T > MAX:
		MAX = T
print(MAX)


n = int(input())
s = [str(n) for n in input().split(' ')]
a = [0] * n
s_b = 'QWERTYUIOPASDFGHJKLZXCVBNM'
for i in range(len(s)):
	for j in range(len(s[i])):
		if s[i][j] in s_b:
			a[i] += 1
print(max(a))


import math
import bisect
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from collections import Counter
I = lambda : int(input())
tup = lambda : map(int, input().split())
lst = lambda : list(map(int, input().split()))
n = I()
ss = input()
s = list(map(str, ss.split()))
result = []
for ele in s:
	count = 0
	for j in ele:
		if j.isupper():
			count += 1
		result.append(count)
print(max(result))


n = int(input())
t = input()
c = 0
v = 0
for i in t:
	if i == ' ':
		v = max(v, c)
		c = 0
	if ord(i) >= 65 and ord(i) <= 90:
		c += 1
v = max(v, c)
print(v)


n = int(input())
l = list(map(str, input().strip().split(' ')))
ans = -1
for i in range(len(l)):
	c = 0
	for j in l[i]:
		if ord(j) <= 90 and ord(j) >= 65:
			c += 1
	ans = max(c, ans)
print(ans)


file = input()
words = [w for w in input().split(' ')]
volume = 0
cap = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
for w in words:
	caps = 0
	for x in w:
		if x in cap:
			caps = caps + 1
		if caps > volume:
			volume = caps
print(volume)


i = input()
text = input().split()
ans = -1
for t in text:
	ta = 0
	for m in t:
		if 'A' <= m <= 'Z':
			ta += 1
	ans = max(ta, ans)
print(ans)


def f(word):
	return len(list(filter(lambda x: x.isupper(), word)))
_ = input()
s = input().split()
print(max((f(word) for word in s)))


input()
m = 0
for i in input().split(' '):
	m = max(m, sum([1 if j.isupper() else 0 for j in i]))
print(m)


import functools
score = lambda word: functools.reduce(lambda x, y: x + y, list(map(lambda x: 1 if x.isupper() else 0, word)), 0)
volume = lambda text: functools.reduce(lambda x, y: x if x > y else y, map(score, text.split(' ')), 0)
no = input()
text = input()
print(volume(text))


a = int(input())
s = input().split()
b = [0] * len(s)
c = ['Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V', 'B', 'N', 'M']
for i in range(len(s)):
	for j in s[i]:
		if j in c:
			b[i] = b[i] + 1
print(max(b))


o = input()
s = input().split()
m = 0
for i in s:
	k = 0
	for j in i:
		k += j.isupper()
	m = max(m, k)
print(m)


n = int(input())
text = input().split()
ans = 0
for word in text:
	kapa = 0
	for ch in word:
		if ch == ch.upper():
			kapa += 1
	ans = max(kapa, ans)
print(ans)


n = int(input())
s = input()
c = 0
l = 0
for i in s:
	m = ord(i)
	if m >= 65 and m <= 91:
		c += 1
	elif i == ' ':
		l = max(c, l)
		c = 0
l = max(l, c)
print(l)


n = int(input())
l = input().strip().split()
max = 0
for i in range(len(l)):
	count = 0
	for j in l[i]:
		if j.isupper():
			count += 1
	if max < count:
		max = count
print(max)


n = int(input())
text = input().split()
ml = 0
for word in text:
	loudness = 0
	for char in word:
		if char == char.upper():
			loudness += 1
	ml = max(ml, loudness)
print(ml)


def Volume(s):
	ans = 0
	for x in s:
		if x >= 'A' and x <= 'Z':
			ans += 1
	return ans
n = int(input())
Text = map(str, input().split())
ans = 0
for x in Text:
	ans = max(ans, Volume(x))
print(ans)


input()
l = input().split()
Mx = 0
for i in l:
	r = 0
	for j in i:
		if ord(j) >= ord('A') and ord(j) <= ord('Z'):
			r += 1
	Mx = max(Mx, r)
print(Mx)


input()
words = list(input().split())
tot = 0
for word in words:
	tot = max(tot, len(list(filter(lambda a: a.isupper(), word))))
print(tot)


n = input()
s = input()
res = 0
mx = 0
for i in s.split():
	for j in i:
		if j.isupper():
			res += 1
	mx = max(res, mx)
	res = 0
print(mx)


n = int(input())
s = str(input())
low = 0
count = 0
for i in range(n):
	if s[i] >= 'A' and s[i] <= 'Z':
		count = count + 1
	if count > low:
		low = count
	if s[i] == ' ':
		count = 0
print(low)


def upper_ct(s):
	count = 1
	for i in s:
		if i.isupper():
			count += 1
	return count
n = int(input())
lst = list(map(str, input().split()))
new = []
for i in range(0, len(lst)):
	new.append(upper_ct(lst[i]))
print(max(new) - 1)


n = int(input())
t = input()
count = 0
vol = 0
for i in t:
	if i == ' ':
		vol = max(vol, count)
		count = 0
	if ord(i) >= 65 and ord(i) <= 90:
		count = count + 1
vol = max(vol, count)
print(vol)


N = int(input())
A = str(input())
chars = []
for i in A:
	chars.append(i)
curr = 0
mx = 0
x = len(chars)
for i in range(0, x):
	if chars[i] == ' ':
		if curr > mx:
			mx = curr
		curr = 0
	elif chars[i] == chars[i].upper():
		curr = curr + 1
if curr > mx:
	mx = curr
print(mx)


A = int(input())
B = input()
temp = 0
temp1 = 0
for i in B:
	if 'A' <= i <= 'Z':
		temp = temp + 1
	elif i == ' ':
		temp = 0
	if temp > temp1:
		temp1 = temp
print(temp1)


(n, text) = (input(), input())
print(max([sum([ch1 != ch2 for (ch1, ch2) in zip(word, word.lower())]) for word in text.split()]))


a = int(input())
s = input().split()
m = 0
for i in s:
	v = 0
	for j in i:
		if ord(j) > 64 and ord(j) < 91:
			v = v + 1
	if v > m:
		m = v
print(m)


(n, a) = (input(), input().split())
k = 0
for i in a:
	ans = 0
	for c in i:
		if c.isupper():
			ans += 1
	k = max(k, ans)
print(k)


def main():
	_ = input()
	words = input().split()
	ans = 0
	for word in words:
		ans = max(sum((1 for c in word if c.isupper())), ans)
	print(ans)
main()


def check_upper(c):
	if c >= 'A' and c <= 'Z':
		return True
	else:
		return False
x = int(input())
y = input().split()
highest = 0
for i in range(0, len(y)):
	a = 0
	for e in range(0, len(y[i])):
		if check_upper(y[i][e]) == True:
			a += 1
	if a > highest:
		highest = a
print(highest)


n = int(input())
l = list(map(str, input().split()))
ans = 0
for i in range(len(l)):
	ans = max(ans, sum(map(str.isupper, l[i])))
print(ans)


n = int(input())
string = str(input())
mas = string.split()
mas_key = []
for i in range(0, len(mas), 1):
	k = 0
	for j in range(0, len(mas[i]), 1):
		if 'A' <= mas[i][j] <= 'Z':
			k = k + 1
	mas_key.append(k)
print(max(mas_key))


input()
print(max([len(''.join(filter(lambda X: X.isupper(), i))) for i in list(input().split())]))


n = int(input())
text = input().split()
vol = 0
k = 0
for x in range(len(text)):
	for t in range(len(text[x])):
		if text[x][t].isupper():
			k += 1
	if k > vol:
		vol = k
	k = 0
print(vol)


input()
print(max((sum((ch.isupper() for ch in w)) for w in input().split())))


n = int(input())
s = input()
(num, rec) = (0, 0)
for i in range(n):
	if s[i] == ' ':
		num = max(rec, num)
		rec = 0
	elif s[i].isupper():
		rec += 1
num = max(rec, num)
print(num)


x = int(input())
arr = input()
count = 0
ans = 0
for i in arr:
	if i == ' ':
		if count >= ans:
			ans = count
		count = 0
	elif ord(i) > 64 and ord(i) < 91:
		count = count + 1
if count >= ans:
	ans = count
print(ans)


n = int(input())
a = str(input())
arr = []
for i in range(1000):
	arr.append(0)
x = 0
for i in a:
	if i.isupper():
		arr[x] += 1
	elif i == ' ':
		x += 1
print(max(arr))


Input = lambda : map(str, input().split())

def cal(s):
	c = 0
	for i in s:
		if i.isupper():
			c += 1
	return c
input()
MAX = -float('inf')
Text = list(Input())
for i in Text:
	MAX = max(MAX, cal(i))
print(MAX)


f = int(input())
n = input().split(' ')
a = []
for i in range(len(n)):
	a.append(n[i])
maxx = 0
for i in range(len(a)):
	count = 0
	c = a[i]
	for j in range(len(c)):
		if ord(c[j]) < 64 or ord(c[j]) > 91:
			continue
		else:
			count += 1
	if count > maxx:
		maxx = count
print(maxx)


def upperCase(st):
	sum = 0
	for i in range(len(st)):
		if st[i].isupper():
			sum += 1
	return sum
input()
a = list(input().split())
_ = []
for __ in range(len(a)):
	_.append(upperCase(a[__]))
print(max(_))


def count(x):
	s = 0
	for i in x:
		if ord(i) <= 96 and ord(i) >= 65:
			s += 1
	return s
n = int(input())
ch = input()
l = list(ch.split())
a = []
for i in range(len(l)):
	a.append(count(str(l[i])))
print(max(a))


import sys
n = int(input())
s = input()
words = s.split()
max = 0
count = 0
for word in words:
	for i in range(len(word)):
		if ord(word[i]) >= 65 and ord(word[i]) <= 90:
			count = count + 1
	if max < count:
		max = count
	count = 0
print(max)


a = int(input())
t = list(input().split())
w = 0
for k in t:
	o = 0
	for i in k:
		if 65 <= ord(i) <= 90:
			o += 1
		if o > w:
			w = o
print(w)


n = int(input())
s = input().split(' ')
ans = 0
for i in range(0, len(s)):
	cnt = 0
	for x in range(0, len(s[i])):
		if s[i][x].isupper():
			cnt += 1
		ans = max(cnt, ans)
print(ans)


n = int(input())
l = input().split()
maxi = 0
for i in l:
	curr = i
	maxi = max(maxi, sum((i.isupper() for i in curr)))
print(maxi)


a = int(input())
b = input()
h = b.split(' ')
g = -1
for i in h:
	f = 0
	for j in i:
		if j <= 'Z' and j >= 'A':
			f += 1
	if f > g:
		g = f
print(g)


n = int(input())
s = input()
m = 0
curr_vol = 0
for i in s:
	if ord(i) >= 65 and ord(i) <= 90:
		curr_vol += 1
	elif i == ' ':
		m = max(m, curr_vol)
		curr_vol = 0
m = max(m, curr_vol)
print(m)


i = input
i()
print(max(map(lambda s: sum([1 if ord(c) >= 65 and ord(c) <= 90 else 0 for c in s]), i().split())))


n = int(input())
s = input().split()
l = []
for i in s:
	c = 0
	for j in i:
		if j.isupper():
			c += 1
	l.append(c)
print(max(l))


n = int(input())
ch = input()
l = ch.split()
m = 0
for i in l:
	s = 0
	for j in i:
		if j == j.upper():
			s = s + 1
		m = max(m, s)
print(m)


a = int(input())
b = input()
c = b.split(' ')
k = b.count(' ')
cnt = 0
d = []
for i in range(k + 1):
	for j in c[i]:
		if j.isupper():
			cnt += 1
			d.append(cnt)
	cnt = 0
if d == []:
	print('0')
else:
	print(max(d))


n = input()
a = input().split()
t = []
for i in a:
	p = 0
	for j in i:
		if j.isupper():
			p += 1
	t += [p]
print(max(t))


n = int(input())
l = list(input().split(' '))
c = 0
ll = []
for i in l:
	for t in i:
		if ord(t) >= 65 and ord(t) <= 90:
			c = c + 1
	ll.append(c)
	c = 0
print(max(ll))


n = int(input())
s = input().split(' ')
(cnt, m) = (0, 0)
for i in s:
	cnt = 0
	for x in i:
		if x.isupper():
			cnt += 1
	if cnt > m:
		m = cnt
print(m)


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()
alf = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']

def main():
	I()
	l = LS()
	ans = 0
	for x in l:
		a = 0
		for s in x:
			if s in alf:
				a += 1
		ans = max(ans, a)
	return ans
print(main())


def main():
	letter = int(input().strip())
	text = input().strip().split(' ')
	result = 0
	for i in text:
		count = 0
		for j in i:
			if str.isupper(j):
				count += 1
		if count > result:
			result = count
	print(result)
main()


input()
print(max((sum(map(str.isupper, word)) for word in input().split())))


n = int(input())
s = input().split()
(cur_min, cur_max) = (0, 0)
for i in range(len(s)):
	for k in range(len(s[i])):
		if s[i][k].istitle():
			cur_min += 1
	if cur_min > cur_max:
		cur_max = cur_min
	cur_min = 0
print(cur_max)


n = int(input())
n1 = input().split()
lst = []
for i in n1:
	s = 0
	for j in i:
		if j.isupper() == True:
			s = s + 1
	lst.append(s)
print(max(lst))


def volumn(word):
	return sum((c.isupper() for c in word))

def main():
	input()
	words = input().split()
	print(max((volumn(word) for word in words)))
main()


input()
s = input()
wo = s.split()
maxim = 0
for word in wo:
	val = 0
	for i in word:
		if i < 'a':
			val += 1
	maxim = max(maxim, val)
print(maxim)


input()
print(max((len(tuple(filter(str.isupper, i))) for i in input().split())))


n = int(input())
s = input()
(c, max) = (0, 0)
for i in s:
	if 65 <= ord(i) <= 90:
		c += 1
	if i == ' ':
		if c > max:
			max = c
		c = 0
if max >= c:
	print(max)
else:
	print(c)


import re
a = list()
n = int(input())
ss = input()
a = re.split(' ', ss)
b = list()
for x in a:
	cnt = 0
	for i in range(len(x)):
		if x[i].isupper() == True:
			cnt += 1
	b.append(cnt)
ans = 0
for x in b:
	if x > ans:
		ans = x
print(ans)


def count_if(l, cond):
	return sum((1 for x in l if cond(x)))
n = input()
ans = max(map(lambda y: count_if(y, lambda t: t.isupper()), input().split(' ')))
print(ans)


n = input()
words = [w for w in input().split(' ')]
m = 0
caps = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
for w in words:
	cnt = 0
	for i in w:
		if i in caps:
			cnt += 1
	if cnt > m:
		m = cnt
print(m)


n = int(input())
s = input()
max_k = 0
k = 0
for i in range(n):
	if 90 >= ord(s[i]) >= 65:
		k += 1
	if s[i] == ' ' or i == n - 1:
		if k > max_k:
			max_k = k
		k = 0
print(max_k)


n = int(input())
e = input().split(' ')
best = 0
for i in e:
	loc = 0
	for j in i:
		if j.isupper():
			loc += 1
	best = max(best, loc)
print(best)


input()
a = input().split()
ans = -1
for s in a:
	cur = 0
	for c in s:
		if ord('A') <= ord(c) <= ord('Z'):
			cur += 1
	ans = max(ans, cur)
print(ans)


size = int(input())
words = input().split()
largest = 0
for word in words:
	count = 0
	for letter in word:
		if letter <= 'Z' and letter >= 'A':
			count += 1
	if count > largest:
		largest = count
print(largest)


n = int(input())
text = [word for word in input().split()]
vol = []
for word in text:
	count = 0
	for letter in word:
		if letter.isupper():
			count += 1
	vol.append(count)
print(max(vol))


_ = int(input())
words = input().split()
max1 = 0
for word in words:
	count = 0
	for i in range(len(word)):
		if word[i].isupper():
			count += 1
	if count > max1:
		max1 = count
print(max1)


def main():
	input()
	words = input().strip().split()
	volume = max((sum((1 for ch in word if 'A' <= ch <= 'Z')) for word in words))
	print(volume)
main()


def get_v(word):
	v = 0
	for ch in word:
		if ch.isupper():
			v += 1
	return v
length = input()
words = input().strip().split()
max_v = 0
for word in words:
	v = get_v(word)
	if max_v < v:
		max_v = v
print(max_v)


from copy import copy
m = int(input())
n = list(map(str, input().split()))
arr = []
i = 0
while i < len(n):
	count = 0
	j = 0
	while j < len(n[i]):
		c = copy(n[i][j])
		c = c.upper()
		if c == n[i][j]:
			count += 1
		j += 1
	arr.append(count)
	i += 1
print(max(arr))


volumes = []
n = int(input())
s = input()
sk = 0
spaces = 1
temp = 0
for i in range(n):
	if s[i] == s[i].upper() and s[i] != ' ':
		temp += 1
	if s[i] == ' ':
		volumes.append(temp)
		temp = 0
	elif i == len(s) - 1:
		volumes.append(temp)
		temp = 0
print(max(volumes))


import sys, math
n = map(int, input().split())
s = list(map(str, input().split()))
m = 0
for word in s:
	cur = 0
	for letter in word:
		if 'Z' >= letter >= 'A':
			cur += 1
	if cur > m:
		m = cur
print(m)


n = int(input())
text = input()
ll = list(text.split())
num = []
for i in range(len(ll)):
	num.append(sum((1 for c in ll[i] if c.isupper())))
print(max(num))


from sys import stdin as fin
n = int(fin.readline())
words = fin.readline().rstrip().split()
maxv = 0
for w in words:
	cv = 0
	for sym in w:
		cv += sym.isupper()
	maxv = max(maxv, cv)
print(maxv)


n = int(input())
s = input()
dem = 0
max = dem
i = 0
while i < n:
	if ord(s[i]) >= 65 and ord(s[i]) <= 90:
		dem = dem + 1
	elif s[i] == ' ':
		if dem > max:
			max = dem
		dem = 0
	i = i + 1
if dem > max:
	max = dem
print(max)


n = int(input())
word = input()
lista = word.split()
count = 0
for a in word:
	if a.isspace() == True:
		count += 1
if count < 1:
	a = sum((1 for c in word if c.isupper()))
	print(a)
elif count >= 1:
	a = sum((1 for c in word if c.isupper()))
	if a == 0:
		print(a)
	elif a >= 1:
		lista2 = [0] * len(lista)
		for i in range(len(lista)):
			b = 0
			for j in lista[i]:
				b = sum((1 for c in lista[i] if c.isupper()))
				lista2[i] = b
		print(max(lista2))


n = int(input())
s = input()
an = 0
v = 0
for i in range(n):
	v += 'A' <= s[i] <= 'Z'
	if s[i] == ' ':
		an = max(an, v)
		v = 0
print(max(an, v))


n = int(input())
string = input()
length = len(string)
let_s = let_b = 0
new = []
if string.count(' ') == 0:
	for i in string:
		if 'A' <= i <= 'Z':
			let_b += 1
	print(let_b)
else:
	for i in string:
		if i != ' ':
			if 'A' <= i <= 'Z':
				let_b += 1
			new.append(let_b)
		else:
			new.append(let_b)
			let_b = 0
	print(max(new))


n = int(input())
mystr = input().split()
max = 0

def volume(x):
	counter = 0
	for i in range(len(x)):
		if 65 <= ord(x[i]) <= 90:
			counter += 1
	return counter
for i in range(len(mystr)):
	if volume(mystr[i]) > max:
		max = volume(mystr[i])
print(max)


n = input()
words = input().split(' ')
ans = 0
for i in words:
	up = 0
	for c in i:
		if c.isupper():
			up += 1
	ans = max(ans, up)
print(ans)


n = int(input())
s = input()
s = s.split(' ')
cnt = 0
for i in range(len(s)):
	temp = 0
	for j in range(len(s[i])):
		if s[i][j].isupper():
			temp += 1
	cnt = max(cnt, temp)
print(cnt)


n = int(input())
L = input().strip().split(' ')
x = 0
for i in L:
	z = 0
	for k in i:
		if ord(k) < 95:
			z += 1
	x = max(x, z)
print(x)


n = int(input())
s = input()
c = 0
f = 0
a = set()
for i in range(n):
	if ord(s[i]) >= 65 and ord(s[i]) <= 90:
		c += 1
	elif s[i] == ' ':
		a.add(c)
		f = 1
		c = 0
	if i == n - 1:
		a.add(c)
if f == 0:
	print(c)
else:
	print(max(a))


n = int(input())
import string
t = input().split(' ')
result = 0
for item in t:
	current = 0
	for letter in item:
		if letter in string.ascii_uppercase:
			current += 1
	result = max(result, current)
print(result)


n = int(input())
s = input().split()
k = 0
for i in s:
	v = 0
	for j in i:
		if 65 <= ord(j) and ord(j) <= 90:
			v += 1
	if v > k:
		k = v
print(k)


x = int(input())
y = input()
a = y.split(' ')
mx = -1
for i in a:
	nw = 0
	for q in i:
		if q.isupper():
			nw += 1
	if mx < nw:
		mx = nw
print(mx)


n = input()
words = input()
words = words.split()
upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
maxWeight = 0
temp = 0
for word in words:
	for i in word:
		if i in upper:
			temp += 1
	if temp > maxWeight:
		maxWeight = temp
	temp = 0
print(maxWeight)


import sys
n = int(input())
s = input()
cap = cnt = 0
for i in range(n):
	if s[i] != ' ' and s[i].isupper():
		cnt += 1
	elif s[i] == ' ':
		cap = max(cap, cnt)
		cnt = 0
if cnt > 0:
	print(max(cap, cnt))
else:
	print(cap)


n = int(input())
s = input()
l = s.split(' ')
li = []
for i in l:
	a = sum((1 for c in i if c.isupper()))
	li.append(a)
print(max(li))


n = int(input())
strs = input().split()
l = []
for i in strs:
	count = 0
	for j in i:
		if j >= 'A' and j <= 'Z':
			count += 1
	l.append(count)
print(max(l))


text_length = int(input())
text = input()
curr = 0
tmp = []
for i in range(text_length):
	if text[i].istitle():
		curr += 1
	elif text[i] == ' ':
		tmp.append(curr)
		curr = 0
tmp.append(curr)
print(max(tmp))


n = int(input())
text = input().split()
ans = 0
for word in text:
	cur_ans = 0
	for let in word:
		if let >= 'A' and let <= 'Z':
			cur_ans += 1
	ans = max(ans, cur_ans)
print(ans)


n = int(input())
entrada = input()
count = 0
v = []
for c in entrada:
	if c.isupper():
		count += 1
	elif c.isspace():
		v.append(count)
		count = 0
v.append(count)
print(max(v))


n = input()
a = input().split()
ans = 0
for i in a:
	now = 0
	for j in i:
		if j == j.upper():
			now += 1
	ans = max(now, ans)
print(ans)


n = input()
s = input()
a = s.split()
ans = 0
for i in a:
	t = len(i)
	cnt = 0
	for j in range(t):
		if i[j] >= 'A' and i[j] <= 'Z':
			cnt += 1
	if cnt > ans:
		ans = cnt
print(ans)


n = int(input())
s = input().split(' ')
ans = 0
for words in s:
	c = 0
	for ch in words:
		if ch >= 'A' and ch <= 'Z':
			c += 1
	ans = max(ans, c)
print(ans)


n = input()
kalimat = input().split()
print(max(map(lambda s: sum([1 for x in s if x.isupper()]), kalimat)))


n = int(input())
text = input().split()
ans = 0
for i in text:
	u = 0
	for j in i:
		u += j.isupper()
	ans = max(u, ans)
print(ans)


import math as mt
import sys, string
input = sys.stdin.readline
from collections import defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
t = 1
for _ in range(t):
	n = I()
	s = list(input().split())
	m = 0
	for i in range(len(s)):
		c = 0
		for j in s[i]:
			if j >= 'A' and j <= 'Z':
				c += 1
		m = max(m, c)
	print(m)


input()

def f(s):
	x = 0
	for i in s:
		if i == i.upper():
			x += 1
	return x
print(max(map(f, input().split())))


class CodeforcesTask837ASolution:

	def __init__(self):
		self.result = ''
		self.word = ''

	def read_input(self):
		input()
		self.word = input()

	def process_task(self):
		letters = 'abcdefghijklmnoqprstuvwxyz'
		for c in letters:
			self.word = self.word.replace(c, '')
		volume = max([len(x) for x in self.word.split(' ')])
		self.result = str(volume)

	def get_result(self):
		return self.result
Solution = CodeforcesTask837ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = int(input())
data = input().split()
m = 0
for word in data:
	c = 0
	for i in word:
		if 64 < ord(i) < 96:
			c += 1
	m = max(m, c)
print(m)


t = int(input())
str = input()
(cnt, maxi) = (0, 0)
lst = []
for i in range(t):
	if str[i].isupper():
		cnt += 1
		maxi = max(cnt, maxi)
	if str[i] == ' ':
		cnt = 0
print(maxi)


n = input()
s = input().split()
i = 0
m = 0
l = []
while i < len(s):
	j = 0
	while j < len(s[i]):
		if s[i][j].isupper():
			m += 1
		j += 1
	l.append(m)
	m = 0
	i += 1
print(max(l))


n = int(input().strip())
words = input().strip().split(' ')
max = float('-inf')
for word in words:
	curr_max = 0
	for char in word:
		if char.isupper() and char.isalpha():
			curr_max += 1
	if curr_max > max:
		max = curr_max
print(max)


import sys

def vol(i):
	ans = 0
	for j in i:
		if 'A' <= j <= 'Z':
			ans += 1
	return ans
n = input()
gg = input().split()
ans = 0
for i in gg:
	ans = max(ans, vol(i))
print(ans)


n = int(input())
s = input().split(' ')
count = []
for i in s:
	count_ = 0
	for j in i:
		if j.isalpha():
			if j.upper() == j:
				count_ += 1
			else:
				continue
	count.append(count_)
print(max(count))


import sys
import math
import bisect
import itertools
import random
import re

def main():
	n = int(input())
	A = list(input().split())
	B = []
	for a in A:
		val = 0
		for c in a:
			if c.isupper():
				val += 1
		B.append(val)
	print(max(B))
main()


n = int(input())
s = list(input().split())
count = 0
for i in s:
	count1 = 0
	for j in i:
		if j.isupper():
			count1 += 1
	count = max(count, count1)
print(count)


n = int(input())
a = input().split()
maxi = 0
per = 0
for w in a:
	for i in w:
		if i == i.upper():
			per += 1
	if maxi < per:
		maxi = per
	per = 0
print(maxi)


import string
alf = string.ascii_uppercase
n = int(input())
mas = input().split()
now = 0
for el in mas:
	gow = 0
	for i in el:
		if i in alf:
			gow += 1
	if now < gow:
		now = gow
print(now)


n = int(input())
l = input().split()
x = []
for i in l:
	count = 0
	for j in i:
		if j == j.upper():
			count += 1
	x.append(count)
print(max(x))


n = int(input())
a = list(input().split())
s = 0
for i in a:
	w = 0
	for j in i:
		if j.isupper():
			w += 1
	s = max(s, w)
print(s)


n = int(input())
s = input().strip().split(' ')
m = 0
for x in s:
	c = 0
	for y in x:
		if y >= 'A' and y <= 'Z':
			c += 1
	m = max(m, c)
print(m)


n = int(input())
s = input().split()
a = []
for val in s:
	count = 0
	for j in range(len(val)):
		if 'A' <= val[j] <= 'Z':
			count += 1
		a.append(count)
print(max(a))


n = int(input())
text = list(map(str, input().split()))
vol_text = 0
for word in text:
	vol_word = 0
	for let in word:
		if let.isupper():
			vol_word += 1
	if vol_word > vol_text:
		vol_text = vol_word
print(vol_text)


def get_count_word(word):
	count = 0
	for ch in word:
		if ord(ch) >= ord('A') and ord(ch) <= ord('Z'):
			count += 1
	return count
n = int(input())
text = input().strip().split()
maxm = -1
for word in text:
	cnt = get_count_word(word)
	if cnt > maxm:
		maxm = cnt
print(maxm)


dic = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}

def check(string):
	output = 0
	for i in range(len(string)):
		if string[i] in dic:
			output += 1
	return output

def text_volume():
	length = int(input())
	text = input()
	alt = ''
	for i in range(len(text)):
		if text[i] != ' ':
			alt = alt + text[i]
		else:
			break
	maximum = check(alt)
	temp = ''
	for i in range(len(text)):
		if text[i] != ' ':
			temp = temp + text[i]
			if i == len(text) - 1:
				temp_max = check(temp)
				if temp_max > maximum:
					maximum = temp_max
		else:
			temp_max = check(temp)
			if temp_max > maximum:
				maximum = temp_max
			temp_max = 0
			temp = ''
	return maximum
A = text_volume()
print(A)


def volume(word):
	return sum((str.isupper(c) for c in word))
l = input()
s = input().split()
print(max((volume(word) for word in s)))


n = int(input())
s = input().split()
i = 0
for j in range(len(s)):
	ss = s[j]
	v = 0
	for k in range(len(s[j])):
		if s[j][k] < 'a':
			v += 1
	i = max(i, v)
print(i)


n = int(input())
s = input()
words = s.split(' ')
letters = 'Q W E R T Y U I O P A S D F G H J K L Z X C V B N M'.split(' ')
ans = 0
for word in words:
	temps = word
	for letter in letters:
		temps = temps.replace(letter, '')
	ans = max(ans, len(word) - len(temps))
print(ans)


n = input()
S = list(map(str, input().split()))
Max = 0
for i in range(len(S)):
	C = 0
	for j in range(len(S[i])):
		if S[i][j].isupper():
			C += 1
	if C > Max:
		Max = C
print(Max)


import re
n = int(input())
s = input().split()
m = 0
for i in s:
	y = len(i)
	x = len(re.sub('[A-Z]', '', i))
	m = max(m, y - x)
print(m)


(n, l) = (int(input()), list(map(str, input().split())))
(x, y) = (0, 0)
for i in range(len(l)):
	for j in l[i]:
		if j.isupper():
			x = x + 1
	if x > y:
		y = x
	x = 0
print(y)


x = int(input())
j = str(input())
j = j + ' '
r = 0
ma = 0
s = 0
while s <= x:
	if j[s].isupper():
		r += 1
	if j[s] == ' ':
		if r > ma:
			ma = r
		r = 0
	s += 1
print(ma)


n = input()
frase = input().split()
ans = 0
for wrd in frase:
	val = 0
	for let in wrd:
		if let.isupper():
			val += 1
	if val > ans:
		ans = val
print(ans)


import sys

def main():
	nbm = 0
	maxnbm = 0
	nbc = sys.stdin.readline()
	chaine = list(sys.stdin.readline())
	for loop in range(int(nbc)):
		if chaine[loop] == ' ':
			if nbm > maxnbm:
				maxnbm = nbm
			nbm = 0
		if chaine[loop].isupper():
			nbm += 1
	print(max(maxnbm, nbm))
main()


l = int(input())
s = input().split()
ls = [0] * len(s)

def wv(string):
	t = 0
	for i in range(len(string)):
		if string[i] == string[i].upper():
			t = t + 1
	return t
for i in range(len(s)):
	ls[i] = wv(s[i])
ls.sort()
print(ls[len(s) - 1])


n = int(input())
a = input()
sm = 0
nm = 0
for i in range(0, n):
	if a[i] == ' ':
		nm = max(sm, nm)
		sm = 0
	elif a[i].isupper() == True:
		sm += 1
print(max(nm, sm))


def volumetext(length, sentence):
	maxvol = 0
	vol = 0
	for word in sentence:
		vol = 0
		for letter in word:
			if letter.upper() == letter:
				vol += 1
		if vol > maxvol:
			maxvol = vol
	return maxvol
length = map(int, input().strip().split())
sentence = input().strip().split()
print(volumetext(length, sentence))


import sys
from bisect import bisect_left as lb
from collections import deque
from queue import PriorityQueue as pq
from math import *
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
inv = lambda x: pow(x, mod - 2, mod)
mod = 10 ** 9 + 7
n = ii()
a = ip().split()
ma = -float('inf')
for i in a:
	t = 0
	for j in i:
		if ord(j) >= 65 and ord(j) < 91:
			t += 1
	ma = max(ma, t)
print(ma)


input()
print(max((sum((1 for c in word if c.isupper())) for word in input().split(' '))))


import re
from functools import partial
substring = partial(re.sub, '[^A-Z]', '')
n = input()
words = input().split()
res = max(map(lambda x: len(substring(x)), words))
print(res)


input()
words = input().split()
print(max(map(lambda w: sum(map(str.isupper, w)), words)))


def list_input():
	return list(map(int, input().split()))

def map_input():
	return map(int, input().split())

def map_string():
	return input().split()
n = int(input())
s = input().split()
ans = 0
for i in s:
	cur = 0
	for j in i:
		if j.upper() == j:
			cur += 1
	ans = max(ans, cur)
print(ans)


input()
print(max((sum((1 for c in w if c.isupper())) for w in input().split())))


input()
S = input().split()
an = 0
for A in S:
	cur = 0
	for s in A:
		if ord(s) >= 65 and ord(s) <= 90:
			cur += 1
	an = max(an, cur)
print(an)


n = int(input())
A = input().split()
maxi = 0
for i in A:
	summ = 0
	for j in i:
		if ord('A') <= ord(j) <= ord('Z'):
			summ += 1
	maxi = max(maxi, summ)
print(maxi)


n = int(input())
arr = []
s = input()
arr = s.split(' ')
arr1 = []
for x in arr:
	v = 0
	for i in x:
		if i.isupper():
			v = v + 1
	arr1.append(v)
arr1.sort(reverse=True)
print(arr1[0])


n = int(input())
s = input().split()
m = 0
for x in s:
	c = 0
	for l in x:
		if l == l.upper():
			c += 1
	m = max(m, c)
print(m)


n = input()
words = input().split()
mv = 0
for w in words:
	v = sum([int(s.isupper()) for s in w])
	mv = max(v, mv)
print(mv)


n = int(input())
s = input()
mas = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
countmax = 0
words = s.split()
for i in words:
	count = 0
	for el in i:
		if el in mas:
			count += 1
	if countmax < count:
		countmax = count
print(countmax)


n = int(input())
s = input().split()
maxi = 0
for x in s:
	ctr = 0
	for y in x:
		if y <= 'Z' and y >= 'A':
			ctr += 1
	if ctr > maxi:
		maxi = ctr
print(maxi)


n = int(input())
x = [x for x in input().split()]
vol = 0
for i in x:
	vol = max(vol, len([j for j in i if j.isupper()]))
print(vol)


n = int(input())
G = [j for j in input().split(' ')]
k = 0
for i in G:
	ans = 0
	for c in i:
		if c.isupper():
			ans += 1
	k = max(k, ans)
print(k)


n = int(input())
(res, tmp) = (0, 0)
strings = input().split()
for i in strings:
	for j in i:
		if j.isupper():
			tmp += 1
	res = max(res, tmp)
	tmp = 0
print(res, end='')


dai = int(input())
tu = input()
rs = 0
temp = 0
for i in tu:
	if i == i.upper() and i != ' ':
		temp += 1
	elif i == ' ':
		if temp > rs:
			rs = temp
		temp = 0
if temp > rs:
	rs = temp
print(rs)


n = int(input())
s = input()
cnt = 0
grs = [0]
for i in range(n):
	if s[i] != ' ':
		if s[i] >= 'A' and s[i] <= 'Z':
			grs[cnt] += 1
	else:
		cnt += 1
		grs.append(0)
maxx = 0
for i in grs:
	if i > maxx:
		maxx = i
print(maxx)


def main():
	input()
	print(max((sum(map(str.isupper, w)) for w in input().split())))
main()


n = int(input())
a = list(input().split())
s = 0
for i in a:
	cnt = 0
	for j in i:
		if j.isupper():
			cnt += 1
	if s < cnt:
		s = cnt
print(s)


t = int(input())
s = input()
x = 0
e = -100
for i in range(t):
	if s[i] >= 'A' and s[i] <= 'Z':
		x += 1
	if s[i] == ' ':
		e = max(e, x)
		x = 0
e = max(e, x)
print(e)


n = int(input())
s = input().split()
m = 0
for w in s:
	k = 0
	for i in w:
		if 'A' <= i <= 'Z':
			k += 1
	if k > m:
		m = k
print(m)


n = int(input())
s = input().split()
maxi = 0
for i in s:
	say = 0
	for k in i:
		if k.isupper():
			say += 1
	if say > maxi:
		maxi = say
print(maxi)


n = int(input())
s = input().split()
ans = 0
d = set()
for i in s:
	cnt = 0
	for j in i:
		if j >= 'A' and j <= 'Z':
			cnt += 1
	ans = max(cnt, ans)
print(ans)


total = 0
_ = input()
for word in input().split(' '):
	word_caps = 0
	for _ in word:
		if not _.islower():
			word_caps += 1
	if word_caps > total:
		total = word_caps
print(total)


from sys import stdin

def volume_of(s):
	count = 0
	for c in s:
		count += 1 if c.isupper() else 0
	return count
n = int(stdin.readline())
data = stdin.readline().rstrip().split()
print(max(list(map(volume_of, data))))


def vol(s):
	c = 0
	for i in s:
		if ord(i) >= 65 and ord(i) <= 92:
			c += 1
	return c
n = int(input())
s = input()
c = 0
s = s.split()
max = 0
for i in s:
	if vol(i) > max:
		max = vol(i)
print(max)


k = input()
n = map(str, input().split())
mx = 0
for s in n:
	i = 0
	for c in s:
		if c >= 'A' and c <= 'Z':
			i += 1
	mx = max(mx, i)
print(mx)


tmp = input()
a = input().split()
ans = 0

def solve(x):
	cnt = 0
	for c in x:
		if 'A' <= c and c <= 'Z':
			cnt += 1
	return cnt
for word in a:
	ans = max(ans, solve(word))
print(ans)


def loud(s):
	cnt = 0
	for i in s:
		if 'A' <= i <= 'Z':
			cnt += 1
	return cnt
n = int(input())
s = input()
s = s.split()
res = 0
for i in s:
	res = max(res, loud(i))
print(res)


n = int(input())
text = list(map(str, input().split()))
maxi = 0
for i in text:
	c = 0
	for j in i:
		if ord(j) >= 65 and ord(j) <= 90:
			c += 1
	if c > maxi:
		maxi = c
print(maxi)


n = int(input())
message = input().split()
l = []
for i in message:
	k = sum((1 for c in i if c.isupper()))
	l.append(k)
print(max(l))


n = int(input())
s = input()
mm = 0
m = 0
for i in range(n):
	if s[i] == ' ':
		mm = max(mm, m)
		m = 0
	elif s[i] >= 'A' and s[i] <= 'Z':
		m += 1
mm = max(mm, m)
print(mm)


n = int(input())
words = input().split()
ans = 0
for w in words:
	cnt = 0
	for c in w:
		if c.isupper():
			cnt += 1
	ans = max(ans, cnt)
print(ans)


n = int(input())
t = input()
count = 0
maxcount = 0
for i in t:
	if ord(i) >= 65 and ord(i) <= 65 + 25:
		count += 1
	elif i == ' ':
		if count > maxcount:
			maxcount = count
		count = 0
if count > maxcount:
	maxcount = count
print(maxcount)


def main():
	N = int(input())
	S = input()
	cnt = 0
	max_ = 0
	for s in S:
		if 'A' <= s <= 'Z':
			cnt += 1
		elif s == ' ':
			max_ = max(max_, cnt)
			cnt = 0
	max_ = max(max_, cnt)
	print(max_)
main()


n = int(input())
s = input()
words = s.split()

def Volume(word):
	result = 0
	for c in word:
		if c >= 'A' and c <= 'Z':
			result += 1
	return result
volumes = [Volume(word) for word in words]
if volumes == []:
	print(0)
else:
	print(max(volumes))


n = int(input())
xs = [x.strip() for x in input().split(' ')]
b = []
for i in range(len(xs)):
	b.append(0)
	for j in xs[i]:
		if j.isupper():
			b[i] = b[i] + 1
b.sort()
print(b[len(xs) - 1])


n = int(input())
s = input().split(' ')
ans = 0
for word in s:
	uplit = 0
	for lit in word:
		if lit.isupper():
			uplit += 1
	if ans < uplit:
		ans = uplit
print(ans)


input()
s = input().split()
ans = 0
for i in s:
	MAX = 0
	for j in i:
		if j in 'QWERTYUIOPASDFGHJKLZXCVBNM':
			MAX += 1
	ans = max(ans, MAX)
print(ans)


input()
s = input().split()
ans = 0
for i in s:
	cnt = 0
	for c in i:
		if c.isupper():
			cnt += 1
	ans = max(ans, cnt)
print(ans)


n = int(input())
a = input().split()
print(max([sum([1 if j.isupper() else 0 for j in i]) for i in a]))


n = int(input())
a = list(input().split())
p = 0
for i in a:
	k = 0
	for j in i:
		if 65 <= ord(j) <= 90:
			k += 1
	if k > p:
		p = k
print(p)


num = int(input().strip())
a = input().strip()
upper_a = a.upper()
upper_num = 0
final_num = 0
for index in range(0, num):
	if a[index] != ' ' and a[index] == upper_a[index]:
		upper_num += 1
	if final_num < upper_num:
		final_num = upper_num
	if a[index] == ' ':
		upper_num = 0
print(final_num)


n = int(input())
a = input().split()
b = max([sum((1 for i in j if i.isupper())) for j in a])
print(b)


n = int(input())
a = input()
a = a.split()
ans = 0
ans1 = 0
for i in range(len(a)):
	k = str(a[i])
	ans = 0
	for j in k:
		if ord(j) >= 65 and ord(j) <= 90:
			ans = ans + 1
	ans1 = max(ans, ans1)
print(ans1)


input()
s = input().split()
k = 0
maxk = 0
q = 'QWERTYUIOPASDFGHJKLZXCVBNM'
for i in s:
	k = 0
	for j in i:
		if j in q:
			k += 1
	if k > maxk:
		maxk = k
print(maxk)


n = int(input())
st = input()
maX = 0
curMax = 0
for i in st:
	if i == ' ':
		if curMax > maX:
			maX = curMax
		curMax = 0
	if i.isupper():
		curMax = curMax + 1
	if i == st[n - 1]:
		if curMax > maX:
			maX = curMax
print(maX)


n = int(input())
s = input()
print(max(map(lambda word: sum(map(lambda char: int(char >= 'A' and char <= 'Z'), word)), s.split(' '))))


n = int(input())
s = input()
s = s + ' '
si = ''
l = []
for i in range(len(s)):
	if s[i] != ' ':
		si = si + s[i]
	else:
		l.append(si)
		si = ''
s = l
ma = 0
for i in s:
	uppers = [l for l in i if l.isupper()]
	ma = max(ma, len(uppers))
print(ma)


input()
print(max([sum([i >= 'A' and i <= 'Z' for i in x]) for x in input().split(' ')]))


n = int(input())
s = input().split(' ')
max_volume = 0
volume = 0
n = len(s)
while n > 0:
	i = 0
	while i < len(s[n - 1]):
		if 90 >= ord(s[n - 1][i]) >= 65 and n == len(s):
			max_volume += 1
		elif 90 >= ord(s[n - 1][i]) >= 65:
			volume += 1
		i += 1
	if volume > max_volume:
		max_volume = volume
	volume = 0
	n -= 1
print(max_volume)


text_length = int(input())
words = list(input().split())
max_volume = 0
for word in words:
	max_volume = max(max_volume, sum([1 for letter in word if str(letter).isupper()]))
print(max_volume)


n = int(input())
s = input().split()
a = []
c = 0
for i in s:
	c = 0
	for j in i:
		if j == j.upper():
			c += 1
	a.append(c)
print(max(a))


import sys
n = sys.stdin.readline()
S = sys.stdin.readline().split()
maxanswer = 0
for word in S:
	answer = 0
	for character in word:
		if ord(character) > 64 and ord(character) < 91:
			answer += 1
		else:
			pass
	maxanswer = max(answer, maxanswer)
print(maxanswer)


li = []
input()
s = input()
ans = 0
for i in range(len(s)):
	if 'A' <= s[i] <= 'Z':
		ans += 1
	if s[i] == ' ' or i == len(s) - 1:
		li.append(ans)
		ans = 0
print(max(li))


input()
a = input().split()
ans = 0
for x in a:
	cnt = 0
	for c in x:
		if c.isupper():
			cnt += 1
	ans = max(ans, cnt)
print(ans)


n = int(input())
a = input().split(' ')
maxVolume = 0
for word in a:
	counter = 0
	for letter in word:
		if ord(letter) < 91:
			counter += 1
		maxVolume = max(maxVolume, counter)
print(maxVolume)


n = int(input())
s = list(map(list, input().split()))
c = 0
m = 0
for i in s:
	c = 0
	for j in i:
		if j.isupper():
			c += 1
	m = max(m, c)
print(m)


n = int(input())
l = list(map(str, input().split()))
s = []
a = 0
for i in range(len(l)):
	for j in range(len(l[i])):
		if l[i][j] == l[i][j].upper():
			a += 1
	s.append(a)
	a = 0
print(max(s))


def tl(s):
	d = 0
	for c in s:
		if c.isupper():
			d += 1
	return d
input()
v = [c for c in input().split()]
m = 0
for c in v:
	l = tl(c)
	if l > m:
		m = l
print(m)


n = int(input())
string = input()
count = 0
maxcount = 0
for i in range(n):
	if string[i].isupper() == True:
		count += 1
	if string[i] == ' ':
		count = 0
		continue
	if count > maxcount:
		maxcount = count
print(maxcount)


a = int(input())
k = input().split()
ans = max((sum((1 for j in i if j.isupper())) for i in k))
print(ans)


x = int(input())
l = input().split()
ans = []
for i in range(len(l)):
	z = list(l[i])
	s = 0
	for j in range(len(z)):
		if ord(z[j]) >= 65 and ord(z[j]) <= 90:
			s += 1
	ans.append(s)
print(max(ans))


n = int(input())
s = str(input())
cnt = ans = 0
for x in s:
	if x.isupper():
		cnt += 1
	elif x == ' ':
		cnt = 0
	ans = max(ans, cnt)
print(ans)


def solution(s):
	ans = 0
	alfie = 'abcdefghijklmnopqrstuvwxyz'.upper()
	for x in s:
		ans = max(ans, len([y for y in list(x) if y in alfie]))
	return ans

def answer():
	n = int(input())
	s = input().split()
	print(solution(s))
answer()


n = int(input())
s = list(map(str, input().split()))
loud = 0
max_loud = 0
for i in range(len(s)):
	for j in range(len(s[i])):
		if 65 <= ord(s[i][j]) <= 90:
			loud += 1
		if max_loud < loud:
			max_loud = loud
	loud = 0
print(max_loud)


n = int(input())
s = input().split(' ')
l = []
for i in s:
	c = 0
	for j in i:
		if j >= 'A' and j <= 'Z':
			c += 1
	l.append(c)
print(max(l))


n = int(input())
s = input().split()
m = 0
for word in s:
	tm = 0
	for symbol in word:
		if symbol.isupper():
			tm += 1
	if tm > m:
		m = tm
print(m)


n = int(input())
st = list(input().split())
l = len(st)
w = [0] * l
for i in range(l):
	for j in st[i]:
		if j.isupper():
			w[i] += 1
print(max(w))


n = int(input())
text = input().split(' ')
maxc = 0
for y in text:
	cnt = 0
	for x in y:
		if 'A' <= x <= 'Z':
			cnt += 1
	maxc = max(maxc, cnt)
print(maxc)


n = int(input())
s = input()
ans = 0
x = 0
for i in range(n):
	if s[i] >= 'A' and s[i] <= 'Z':
		x += 1
	elif s[i] == ' ':
		if ans < x:
			ans = x
		x = 0
	else:
		continue
if ans < x:
	ans = x
print(ans)


n = int(input())
a = input().split()
print(max((sum((str(i).isupper() for i in j)) for j in a)))


numLetters = input()
listOfWords = input()
maxCap = 0
wordList = listOfWords.split()
for item in wordList:
	numUp = 0
	for char in item:
		if char.isupper():
			numUp += 1
	if numUp > maxCap:
		maxCap = numUp
print(maxCap)


n = int(input())
a = [str(i) for i in input().split()]
x = h = 0
for i in a:
	for j in i:
		if 'A' <= j and j <= 'Z':
			h += 1
	if h > x:
		x = h
	h = 0
print(x)


n = input()
d = input().split()
ans = 0
for s in d:
	k = 0
	for c in s:
		if c >= 'A' and c <= 'Z':
			k += 1
	ans = max(ans, k)
print(ans)


qtd = int(input())
entrada = input().split(' ')
qtd = 0
for palavra in entrada:
	contador = 0
	for letra in palavra:
		if letra.isupper():
			contador += 1
	qtd = max(contador, qtd)
print(qtd)


n = int(input())
s = input().split()
print(max(map(lambda si: len(list(filter(lambda c: ord(c) < ord('a'), si))), s)))


n = int(input())
l = input().split()
ans = 0
t = 0
for i in l:
	for j in i:
		if j.isupper():
			t += 1
	ans = max(ans, t)
	t = 0
print(ans)


input()
print(max(list(map(lambda x: sum([1 for c in x if c.isupper()]), input().split()))))


n = int(input())
a = input().split()
ans = 0

def f(s):
	res = 0
	for i in range(0, len(s)):
		if 'A' <= s[i] <= 'Z':
			res += 1
	return res
for i in range(0, len(a)):
	ans = max(ans, f(a[i]))
print(int(ans))


n = int(input())
s = input()
c = 0
t = 0
for i in range(n):
	if s[i] >= 'A' and s[i] <= 'Z':
		c += 1
	if s[i] == ' ':
		t = max(t, c)
		c = 0
t = max(t, c)
print(t)


t = int(input())
s = input().split(' ')
max1 = 0
for x in s:
	yo = sum((1 for ch in x if ch.isupper()))
	if max1 < yo:
		max1 = yo
print(max1)


n = int(input())
s = input()
i = 0
m = 0
c = 0
t = s.upper()
while i < len(s):
	f = True
	if s[i] == ' ':
		c = 0
		f = False
	if s[i] == t[i] and f:
		c += 1
	if m < c:
		m = c
	i += 1
print(m)


n = int(input())
text = list(map(str, input().split()))
answer = 0
for word in text:
	now = 0
	for let in word:
		if let.isupper():
			now += 1
	answer = max(answer, now)
print(answer)


input()
z = input().split()
k = []
for i in z:
	c = 0
	for j in i:
		if j.upper() == j:
			c += 1
	k.append(c)
print(max(k))


import string
upper = set(string.ascii_uppercase)
input()
print(max((sum((c in upper for c in w)) for w in input().split())))


n = int(input())
txt = input().split()
volM = 0
for word in txt:
	vol = 0
	for letter in word:
		if letter.isupper():
			vol += 1
	if vol > volM:
		volM = vol
print(volM)


n = int(input())
s = input()
words = s.split(' ')
letters = [chr(i) for i in range(65, 91)]
ans = 0
for word in words:
	temps = word
	for letter in letters:
		temps = temps.replace(letter, '')
	ans = max(ans, len(word) - len(temps))
print(ans)


n = int(input())
t = input().split()
ans = 0
for w in t:
	m = sum((1 for c in w if 'A' <= c <= 'Z'))
	ans = max(ans, m)
print(ans)


x = input()
n = input().split()
maxCap = 0
cap = 0
for x in n:
	for i in x:
		if i.isupper():
			cap += 1
	if cap > maxCap:
		maxCap = cap
	cap = 0
print(maxCap)


l = int(input())
mx = 0
for i in input().split():
	mx = max(mx, len(list(filter(lambda s: s.isupper(), i))))
print(mx)


n = int(input())
s = input()
l = list(s.split())
li = []
for i in l:
	cou = 0
	for j in range(len(i)):
		if i[j] >= 'A' and i[j] <= 'Z':
			cou += 1
	li.append(cou)
print(max(li))


n = int(input())
words = input().split(' ')
maxm = 0
for word in words:
	count = 0
	for letter in word:
		if letter.isupper():
			count += 1
	maxm = max(maxm, count)
print(maxm)


from copy import copy
a = int(input())
n = 0
nmax = 0
for s in input().split():
	n = 0
	for x in s:
		if ord(x) < 97:
			n += 1
	if n > nmax:
		nmax = copy(n)
print(nmax)


n = int(input())
s = list(input().strip().split())
m = 0
count = 0
for word in s:
	count = 0
	for c in word:
		if c.isupper():
			count = count + 1
	m = max(m, count)
print(m)


import sys
n = int(input())
ss = input()
ss = ss.split(' ')
mm = 0
for i in range(0, len(ss)):
	count = 0
	for j in range(0, len(ss[i])):
		if ss[i][j] >= 'A' and ss[i][j] <= 'Z':
			count += 1
	if count > mm:
		mm = count
print(mm)


n = input()
a = list(input().split())
m = -1
for i in a:
	c = 0
	for j in i:
		if j >= 'A' and j <= 'Z':
			c += 1
	m = max(c, m)
print(m)


n = int(input())
s = list(map(str, input().split()))
a = []
for i in s:
	b = []
	for j in i:
		b.append(ord(j))
	a.append(b)
c = []
for i in a:
	count = 0
	for j in i:
		if j in range(65, 91):
			count += 1
	c.append(count)
print(max(c))


input()
words = input().split()
m = max((sum(map(lambda a: 1 if a.isupper() else 0, w)) for w in words))
print(m)


a = input()
a = input().split()
best = 0
for i in a:
	ans = 0
	for l in i:
		if l >= 'A' and l <= 'Z':
			ans += 1
	if ans > best:
		best = ans
print(best)


n = int(input())
words = list(input().split())
volumes = []
for x in words:
	a = 0
	for y in x:
		if y.upper() == y:
			a += 1
	volumes.append(a)
print(max(volumes))


input()
l = list(input().split())
m = 0
for i in l:
	a = 0
	for j in i:
		if ord(j) < 91:
			a += 1
	m = max(a, m)
print(m)


n = int(input())
ws = input().split()
ans = max(map(lambda w: len(list(filter(lambda c: c.isupper(), w))), ws))
print(ans)


n = int(input())
s = input()
m = 0
sum = 0
for i in range(len(s)):
	if s[i] == ' ':
		m = max(m, sum)
		sum = 0
	if s[i].isupper():
		sum += 1
m = max(m, sum)
print(m)


n = int(input())
l = [i for i in input().split()]
m = 0
for i in l:
	c = 0
	for j in i:
		if ord(j) < 97:
			c += 1
	m = max(m, c)
print(m)


input()
ans = 0
for s in input().split():
	tmp = 0
	for j in s:
		if ord(j) >= ord('A') and ord(j) <= ord('Z'):
			tmp += 1
	ans = max(ans, tmp)
print(ans)


n = int(input())
st = input()
tam = 0
res = 0
for i in st:
	if i >= 'A' and i <= 'Z':
		tam += 1
	elif i == ' ':
		if tam > res:
			res = tam
		tam = 0
if tam > res:
	res = tam
print(res)


def textVolume(n, s):
	C = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'Ñ', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
	cons = []
	con = 0
	for x in s:
		if x in C:
			con = con + 1
		elif x == ' ':
			cons.append(con)
			con = 0
	cons.append(con)
	cons.sort(reverse=True)
	return cons[0]

def main():
	n = int(input())
	s = input()
	print(textVolume(n, s))
main()


print(max((sum((x.isupper() for x in y)) for y in [*open(0)][1].split())))


n = int(input())
a = list(input().strip().split(' '))
maxcp = 0
for s in a:
	ccp = 0
	for i in s:
		if i.isupper():
			ccp += 1
	maxcp = max(maxcp, ccp)
print(maxcp)


input()
print(max((len(tuple(filter(lambda s: s.isupper(), i))) for i in input().split())))


n = int(input())
a = input().split()
b = []
c = 0
for i in range(len(a)):
	c = 0
	for j in range(len(a[i])):
		if ord('Z') >= ord(a[i][j]) >= ord('A'):
			c = c + 1
	b.append(c)
print(max(b))


n = int(input())
capital = ['A', 'B', 'C', 'D', 'E', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
linha = input().split()
sum_max = 0
for palavra in linha:
	s = 0
	for ch in palavra:
		if ch in capital:
			s += 1
			if s > sum_max:
				sum_max = s
print(sum_max)


n = int(input())
text = input().split()
maxCount = 0
for w in text:
	count = 0
	for l in w:
		if ord(l) >= 65 and ord(l) <= 90:
			count += 1
	if count > maxCount:
		maxCount = count
print(maxCount)


a = int(input())
b = input().split()
sum = -1
for i in b:
	temp = 0
	for j in range(len(i)):
		if i[j].isupper():
			temp += 1
	sum = max(sum, temp)
print(sum)


n = int(input())
s = input().split()
k = 0
for j in s:
	m = 0
	for i in j:
		if i >= 'A' and i <= 'Z':
			m += 1
	k = max(m, k)
print(k)


import sys, math, queue, bisect
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)
n = int(input())
ans = 0
for word in input().split():
	volume = 0
	for letter in word:
		if ord(letter) < 97:
			volume += 1
	ans = max(ans, volume)
print(ans)


(input(), print(max([sum([ord('A') <= ord(c) and ord(c) <= ord('Z') for c in w]) for w in str(input()).split()])))


n = int(input())
s = input().split()
maxG = 0
for i in s:
	word = i
	wordG = 0
	for j in word:
		if ord(j) < 97:
			wordG = wordG + 1
	if wordG > maxG:
		maxG = wordG
print(maxG)


n = int(input())
s = str(input()) + ' '
c = 0
m = 0
for el in s:
	if el == ' ':
		m = max(m, c)
		c = 0
	elif ord(el) <= 96:
		c += 1
print(m)


n = int(input())
s = input().split()
num = []
c = 0
for i in s:
	c = 0
	for j in i:
		if ord(j) > 64 and ord(j) <= 90:
			c += 1
	num.append(c)
print(max(num))


import string
input()
s = input().split()
e = []
for x in s:
	e.append(len(list(filter(lambda y: y in string.ascii_uppercase, x))))
print(max(e))


n = int(input())
s = input()
ans = 0
for s1 in s.split():
	cnt = 0
	for i in range(len(s1)):
		cnt += ord(s1[i]) < ord('a') or ord(s1[i]) > ord('z')
	ans = max(ans, cnt)
print(ans)


n = int(input())
list1 = [x for x in input().split()]
if len(list1) == 1:
	count = 0
	for i in range(len(list1[0])):
		if list1[0][i].isupper():
			count += 1
	print(count)
else:
	maxCount = 0
	for i in range(len(list1)):
		count = 0
		for j in range(len(list1[i])):
			if list1[i][j].isupper():
				count += 1
		if count >= maxCount:
			maxCount = count
	print(maxCount)


n = int(input())
text = input().split()
ans = 0
for word in text:
	count = 0
	for c in word:
		if c >= 'A' and c <= 'Z':
			count += 1
	ans = max(ans, count)
print(ans)


input()
print(max(map(lambda w: sum((c.isupper() for c in w)), (w for w in input().split()))))


input()
l = [i for i in input().split()]
ans = 0
for i in l:
	d = 0
	for j in i:
		if j.isupper():
			d += 1
	ans = max(ans, d)
print(ans)


n = eval(input())
s = input().split()
ans = 0
for word in s:
	count = len([letter for letter in word if letter.isupper()])
	ans = max(ans, count)
print(ans)


def solve(text):
	l_text = 0
	l_word = 0
	for ch in text:
		if ch in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
			l_word += 1
		elif ch in 'abcdefghijklmnopqrstuvwxyz':
			pass
		else:
			l_text = max(l_text, l_word)
			l_word = 0
	l_text = max(l_text, l_word)
	return l_text
_ = input()
print(solve(input()))


_ = int(input())
l = list(input().strip().split())
z = []
for x in l:
	count = 0
	for y in x:
		if y.isupper():
			count += 1
	z.append(count)
print(max(z))


n = int(input())
l = list(map(str, input().strip().split()))
ans = 0
for x in l:
	c = 0
	for y in x:
		if y.isupper():
			c += 1
	if c > ans:
		ans = c
print(ans)


input()
print(max(map(lambda x: sum((c.isupper() for c in x)), input().split())))


n = int(input())
s = input()
tokens = s.split(' ')
m = 0
for w in tokens:
	current = 0
	for c in w:
		if c.isupper():
			current += 1
	m = max(current, m)
print(m)


n = int(input())
s = input()
L = s.split(' ')
mx = 0
t = 0
for i in range(len(L)):
	for j in range(len(L[i])):
		if ord(L[i][j]) <= 90:
			t += 1
	mx = max(mx, t)
	t = 0
print(mx)


big_letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
max_n = 0
n = int(input())
a = input().split(' ')
for el in a:
	n = 0
	for i in el:
		if i in big_letters:
			n += 1
	if n > max_n:
		max_n = n
print(max_n)


leng = int(input())
text = input()
grom = 0
mgrom = 0
for sym in range(leng):
	if text[sym].isupper():
		grom = grom + 1
	elif text[sym] == ' ':
		if grom > mgrom:
			mgrom = grom
		grom = 0
if grom > mgrom:
	mgrom = grom
print(mgrom)


n = input()
s = list(input().split())
vol = 0
for i in s:
	t = 0
	for j in i:
		if j.isupper():
			t += 1
	if t > vol:
		vol = t
print(vol)


n = int(input())
s = str(input())
s = s.split(' ')
Max = 0
for i in s:
	Count = 0
	for j in i:
		if j >= 'A' and j <= 'Z':
			Count += 1
	Max = max(Max, Count)
print(Max)


from sys import stdin
n = int(input())
l = list(stdin.readline().split())
maxm = 0
for i in range(len(l)):
	if maxm < sum((1 for c in l[i] if c.isupper())):
		maxm = sum((1 for c in l[i] if c.isupper()))
print(maxm)


import string
input()
words = input().split(' ')
count = []
for word in words:
	tmp = 0
	for char in word:
		if char in string.ascii_uppercase:
			tmp += 1
	count.append(tmp)
print(max(count))


def calculate(word):
	result = 0
	for char in word:
		result += 1 if char.isupper() else 0
	return result
n = input()
words = input().split()
screams = [calculate(word) for word in words]
print(max(screams))


n = int(input())
s = input()
L = s.split()
tmp = 0
mx = 0
for i in range(len(L)):
	for j in range(len(L[i])):
		if L[i][j] <= 'Z':
			tmp += 1
	mx = max(mx, tmp)
	tmp = 0
print(mx)


n = int(input())
ar = input().split()
max = 0
for i in ar:
	t = 0
	for j in i:
		if j.upper() == j:
			t += 1
	if t > max:
		max = t
print(max)


def determiner(stroka):
	maxx = 0
	for m in range(len(stroka)):
		if stroka[m].isupper():
			maxx = maxx + 1
	return maxx
t = int(input())
stroka = input() + ' '
maks = 0
m = 0
for i in range(t + 1):
	if stroka[i] == ' ':
		ans = stroka[m:i]
		m = i + 1
		num = determiner(ans)
		if num > maks:
			maks = num
		num = 0
print(maks)


n = input()
a = input().split()
mx = 0
for i in a:
	cur = 0
	for j in range(len(i)):
		if i[j] >= 'A' and i[j] <= 'Z':
			cur += 1
	mx = max(mx, cur)
print(mx)


n = int(input())
s = input().split()
mx = 0
for c in s:
	tot = 0
	for x in c:
		if x == x.upper():
			tot += 1
	mx = max(mx, tot)
print(mx)


wordsNum = input()
words = input().split()
mostVolWord = 0
for word in words:
	volCh = 0
	for ch in word:
		if ch.isupper():
			volCh += 1
	if volCh > mostVolWord:
		mostVolWord = volCh
print(mostVolWord)


n = int(input())
text = input().split()
ans = 0
for word in text:
	cnt = 0
	for letter in word:
		if letter.isupper():
			cnt += 1
	ans = max(ans, cnt)
print(ans)


NumC = list(map(int, input().split()))
Word = input().split()
upper = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
MMayus = 0
for a in range(len(Word)):
	thing = 0
	for b in range(len(Word[a])):
		if Word[a][b] in upper:
			thing += 1
		if thing > MMayus:
			MMayus = thing
print(MMayus)


input()
a = input().split()
volume = 0
for word in a:
	word_volume = 0
	for symbol in word:
		if symbol.isupper():
			word_volume += 1
	volume = max(volume, word_volume)
print(volume)


n = int(input())
s = list(map(str, input().split()))
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
result = list()
for i in s:
	count = 0
	for j in i:
		if j in alpha:
			count = count + 1
	result.append(count)
print(max(result))


n = int(input())
s = input().split()
b = []
for i in s:
	count = 0
	for j in range(len(i)):
		if i[j].isupper():
			count += 1
	b.append(count)
print(max(b))


n = int(input())
word = list(map(str, input().split()))
mx = 0
for i in word:
	cnt = 0
	for alp in i:
		if alp.isupper() == True:
			cnt += 1
	mx = max(cnt, mx)
print(mx)


import sys
n = int(input())
s = input().split()
m = 0
for string in s:
	tmp = 0
	for c in string:
		if c.isupper():
			tmp += 1
	if tmp > m:
		m = tmp
print(m)


n = int(input())
ch1 = str(input())
count = 0
max = 0
for i in range(n):
	if ch1[i] <= 'Z' and ch1[i] >= 'A':
		count = count + 1
	if ch1[i] == ' ':
		if max <= count:
			max = count
		count = 0
if max <= count:
	max = count
print(max)


s1 = input()
wl = input().split()

def Laud(w):
	cnt = 0
	for ch in w:
		if ch.isupper():
			cnt += 1
	return cnt
m = 0
for wd in wl:
	m = max(m, Laud(wd))
print(m)


input()

def v(x):
	ret = 0
	for i in x:
		if ord('A') <= ord(i) <= ord('Z'):
			ret += 1
	return ret
print(max((v(i) for i in input().strip().split())))


N = int(input())
ar = [i for i in input().split()]
m = 0
for i in range(len(ar)):
	k = 0
	for j in range(len(ar[i])):
		if ar[i][j].isupper() == True:
			k += 1
		if k > m:
			m = k
print(m)


c = 0
a = []
x = int(input())
z = input()
for i in range(x):
	if z[i] >= 'A' and z[i] <= 'Z':
		c += 1
	if z[i] == ' ':
		a.append(c)
		c = 0
if a != [] and max(a) > c:
	print(max(a))
else:
	print(c)


num = int(input())
text = input()
l = len(text)
words = text.split()
lw = len(words)
vol = []
if num == l and (num > 0 and num < 201):
	for i in range(0, lw):
		word = words[i]
		le = len(word)
		word_vol = 0
		for j in range(0, le):
			if word[j].isupper():
				word_vol += 1
		vol.append(word_vol)
vol.sort()
print(vol[-1])


n = int(input())
s = 0
max = 0
l = [j for j in input().split(' ')]
for i in l:
	l1 = list(i)
	s = 0
	for k in l1:
		if k >= 'A' and k <= 'Z':
			s = s + 1
	if s > max:
		max = s
print(max)


def str_volume(s):
	d = 0
	for c in s:
		if c.isupper():
			d += 1
	return d

def text_volume(v):
	mx = 0
	for d in v:
		t = str_volume(d)
		if t > mx:
			mx = t
	return mx
input()
v = [c for c in input().split()]
print(text_volume(v))


input()
print(max((sum(map(str.isupper, i)) for i in input().split())))


a = input()
b = input().split()
ans = 0
for x in b:
	c = sum([1 for q in x if q.isupper()])
	if c > ans:
		ans = c
print(ans)


i = input()
n = int(i)
maxv = 0
curv = 0
c = input()
for i in range(0, n):
	if c[i].isupper():
		curv += 1
	if c[i] == ' ':
		if curv > maxv:
			maxv = curv
		curv = 0
if curv > maxv:
	maxv = curv
print(maxv)


n = int(input())
s = input().split()
ans = 0
for i in range(len(s)):
	caps = 0
	for j in range(len(s[i])):
		if s[i][j].isupper():
			caps += 1
	ans = max(caps, ans)
print(ans)


a = input().strip()
s = input().strip()
s += ' '
vol = 0
maxi = 0
for a in s:
	if a >= 'A' and a <= 'Z':
		vol += 1
	if a == ' ':
		if vol > maxi:
			maxi = vol
		vol = 0
print(maxi)


n = int(input())
s = input()
(count, maxi) = (0, 0)
for i in range(n):
	if s[i] != ' ':
		ascii = ord(s[i])
		if 90 >= ascii >= 65:
			count += 1
	else:
		maxi = max(maxi, count)
		count = 0
maxi = max(maxi, count)
print(maxi)


n = int(input())
s = input()
d = ''
k = 0
h = 0
for i in range(n):
	if ord(s[i]) != 32:
		if s[i].isupper():
			k += 1
	if ord(s[i]) == 32:
		if k > h:
			h = k
			i += 1
		k = 0
print(max(h, k))


def f(word):
	return len(list([x for x in word if x.isupper()]))
_ = input()
s = input().split()
print(max((f(word) for word in s)))


import re
pattern = re.compile('[A-Z]')

def count_of_match(string):
	return len(pattern.findall(string))
input()
input_str = input()
splitted_input = input_str.split(' ')
max_v = count_of_match(splitted_input[0])
for i in range(len(splitted_input)):
	if max_v < count_of_match(splitted_input[i]):
		max_v = count_of_match(splitted_input[i])
print(max_v)


_ = input()
xs = input().split()
print(max(map(lambda x: len(list(filter(lambda y: y >= 'A' and y <= 'Z', x))), xs)))


n = int(input())
l = list(input().split(' '))
ans = 0
an = 0
for s in l:
	for j in range(len(s)):
		if s[j].isupper():
			ans = ans + 1
	if an < ans:
		an = ans
	ans = 0
print(an)


l = int(input())
n = input().split()
c = []
for i in n:
	a = list(i)
	k = 0
	for j in a:
		if ord(j) <= 90:
			k += 1
	c.append(k)
print(max(c))


n = int(input())
text = input().split()
maxVolume = 0
for word in text:
	volume = 0
	for c in word:
		if c.isupper():
			volume += 1
	maxVolume = max(volume, maxVolume)
print(maxVolume)


number = input()
s = input()
d = s.split(' ')
ans = 0
for item in d:
	itemnumber = 0
	for i in item:
		if 'A' <= i <= 'Z':
			itemnumber += 1
	ans = ans if itemnumber < ans else itemnumber
print(ans)


input()
ans = 0
for s in input().split():
	a = 0
	for c in s:
		if c.isupper():
			a += 1
	ans = max(ans, a)
print(ans)


n = int(input())
lst = input().split()
v = 0
for x in lst:
	cout = 0
	for y in x:
		if y >= 'A' and y <= 'Z':
			cout += 1
		if cout > v:
			v = cout
print(v)


n = int(input())
s = input()
cnt = 0
b = []
c = s.count(' ')
if c > 0:
	for i in s:
		if i.isupper():
			cnt += 1
		elif i == ' ':
			b.append(cnt)
			cnt = 0
	b.append(cnt)
	print(max(b))
else:
	for i in s:
		if i.isupper():
			cnt += 1
	print(cnt)


n = int(input())
x = list(input().split())
ma = 0
for i in x:
	ca = 0
	for a in i:
		if 'A' <= a <= 'Z':
			ca += 1
	if ca > ma:
		ma = ca
print(ma)


a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
n = int(input())
b = input()[:n]
d = 0
volume = 0
for i in range(len(b)):
	if b[i] in a:
		volume += 1
	if b[i] == ' ' or len(b) - 1 == i:
		if volume >= d:
			d = volume
		volume = 0
print(d)


n = input()
s = input()
words = s.split()
t_vol = 0
for word in words:
	vol = 0
	for l in word:
		if l.isupper():
			vol = vol + 1
	t_vol = max(t_vol, vol)
print(t_vol)


input()
(cnt, ans) = (0, 0)
for x in input():
	if x.isupper():
		cnt += 1
		ans = max(ans, cnt)
	elif x == ' ':
		cnt = 0
print(ans)


n = int(input())
s = input()
ans = 0
temp = 0
for i in s:
	if i == ' ':
		ans = max(ans, temp)
		temp = 0
	if i >= 'A' and i <= 'Z':
		temp += 1
ans = max(ans, temp)
print(ans)


maxcnt = 0
n = input()
s = input()
l = s.split(' ')
for i in l:
	cnt = 0
	for j in i:
		if j.isupper():
			cnt += 1
	if cnt > maxcnt:
		maxcnt = cnt
print(maxcnt)


import re
r = re.compile('[A-Z]')
n = int(input())
print(len(r.findall(max(input().split(), key=lambda w: len(r.findall(w))))))


n = int(input())
s = input().strip().split(' ')

def ans(s):
	cnt = int(0)
	for x in s:
		if 'A' <= x and x <= 'Z':
			cnt += 1
	return cnt
an = int(0)
for st in s:
	an = max(an, ans(st))
print(an)


x = input()
z = input().split()
mx = 0
for i in z:
	pres = 0
	for a in i:
		if a >= 'A' and a <= 'Z':
			pres += 1
	if mx < pres:
		mx = pres
print(mx)


n = int(input())
cad = input()
pals = cad.split(' ')
sol = 0
solfinal = 0
for pal in pals:
	for c in pal:
		if c >= 'A' and c <= 'Z':
			sol = sol + 1
	if sol >= solfinal:
		solfinal = sol
	sol = 0
print(solfinal)


import string
input()
text = input().split()
res = 0
for i in text:
	cres = 0
	for j in string.ascii_uppercase:
		cres += i.count(j)
	res = max(res, cres)
print(res)


input()
a = list(input().split())
rs = 0
for s in a:
	t = 0
	for i in s:
		if 'A' <= i and i <= 'Z':
			t += 1
	rs = max(rs, t)
print(rs)


number = int(input())
text = input().split()
text_volume = []
for i in text:
	word_volume = 0
	for j in i:
		if j.isupper():
			word_volume += 1
	text_volume.append(word_volume)
print(max(text_volume))


N = input()
text = list(input().split())
volume = 0
max_volume = 0
abc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for word in text:
	for char in word:
		if char in abc:
			volume += 1
	max_volume = max(max_volume, volume)
	volume = 0
print(max_volume)


import re
input()
sentence = input()
words = sentence.split(' ')
pattern = '[A-Z]'
lst = []
for i in range(len(words)):
	lst.append(len(re.findall(pattern, words[i])))
print(max(lst))


import sys
import string
import math

def countsetBits(n):
	count = 0
	while n > 0:
		n &= n - 1
		count += 1
	return count
import operator
n = int(input().strip())
count = 0
a = [x for x in input().strip().split(' ')]
for word in a:
	temp = 0
	for letter in word:
		if letter.isupper():
			temp += 1
	count = max(count, temp)
print(count)


n = int(input())
s = input()
maximo = 0
cont = 0
for i in range(0, n):
	if s[i] == ' ':
		cont = 0
	elif ord(s[i]) > 64 and ord(s[i]) < 91:
		cont += 1
	if cont > maximo:
		maximo = cont
print(maximo)


n = int(input())
s = input().split()
res = 0
for palavra in s:
	ss = 0
	for c in palavra:
		if c.isupper():
			ss += 1
		res = max(res, ss)
print(res)


n = int(input())
a = input().split()
m = 0
for s in a:
	k = 0
	for c in s:
		if c >= 'A' and c <= 'Z':
			k += 1
	if m < k:
		m = k
print(m)


n = int(input())
s = input().split()
ans = 0
for word in s:
	v = 0
	for q in word:
		if q >= 'A' and q <= 'Z':
			v += 1
	ans = max(ans, v)
print(ans)


from math import gcd

def inp():
	return int(input())

def linp():
	return list(map(str, input().split(' ')))

def minp():
	return map(int, input().split(' '))
n = inp()
a = linp()
b = []
b.append(0)
for k in a:
	cnt = 0
	for i in k:
		if i.isupper():
			cnt += 1
	b.append(cnt)
b = sorted(b)
print(b[len(b) - 1])


inp = int(input())
mas = list(input().split())
maxx = 0
for i in mas:
	now = 0
	for j in i:
		if ord(j) < 91:
			now += 1
	if maxx < now:
		maxx = now
print(maxx)


n = input()
A = input().split()
max1 = 0
for i in A:
	temp = 0
	for j in i:
		if ord(j) < 92:
			temp += 1
	max1 = max(max1, temp)
print(max1)


alpha = set('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
n = input()
l = input().split()
maxcount = 0
for w in l:
	count = 0
	for ch in w:
		if ch in alpha:
			count += 1
	maxcount = max(count, maxcount)
print(maxcount)


n = input()
line = input()
ans = 0

def calc(word):
	cnt = 0
	for letter in word:
		if letter.isupper():
			cnt += 1
	return cnt
for word in line.split():
	ans = max(ans, calc(word))
print(ans)


n = int(input())
s = list(input().split())
cnt = []
res = []
for i in s:
	for j in i:
		if j.isupper():
			cnt.append(1)
	res.append(sum(cnt))
	cnt.clear()
print(max(res))


n = int(input())
s = list(map(str, input().split()))
m = 0
for i in range(len(s)):
	c = 0
	for j in s[i]:
		if j.isupper():
			c = c + 1
	if c > m:
		m = c
print(m)


n = int(input())
a = input().split()
ans = 0
for i in a:
	cnt = 0
	for e in i:
		if e in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
			cnt += 1
	ans = max(ans, cnt)
print(ans)


import re
n = int(input())
m = input()
lis = m.split()
MAX = 0
for i in lis:
	l = len(re.compile('[A-Z]').findall(i))
	if l > MAX:
		MAX = l
print(MAX)


import sys

def main():
	(_, *s) = sys.stdin.read().strip().split()
	return max((sum((i.isupper() for i in j)) for j in s))
print(main())


input()
print(max((sum((y.isupper() for y in x)) for x in input().split(' '))))


import string
cap = string.ascii_uppercase
n = input()
s = input().split()
print(max([sum([1 for i in x if i in cap]) for x in s]))


_ = input()
max_vol = 0
for w in input().split():
	vol = 0
	for c in w:
		if c == c.upper():
			vol += 1
	if vol > max_vol:
		max_vol = vol
print(max_vol)


n = int(input())
ans = 0
text = input().split()
for item in text:
	count = 0
	for i in item:
		if i.isupper():
			count += 1
	ans = max(ans, count)
print(ans)


n = int(input())
a = input().split()
ans = []
for i in a:
	c = 0
	for j in range(len(i)):
		if ord(i[j]) >= 65 and ord(i[j]) <= ord('Z'):
			c += 1
	ans.append(c)
print(max(ans))


size = int(input())
string = input()
answer = []
list = string.split()
for i in list:
	counter = 0
	for x in i:
		if x.isupper():
			counter += 1
	answer.append(counter)
print(max(answer))


_ = input()
text = input()
mx_volume = 0
volume = 0
for x in text:
	if x.isupper():
		volume += 1
	elif x == ' ':
		volume = 0
	mx_volume = max(mx_volume, volume)
print(mx_volume)


def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))

def solve():
	n = ri()
	m = 0
	curr = 0
	for c in input():
		if c in 'QWERTYUIOPASDFGHJKLZXCVBNM':
			curr += 1
		elif c == ' ':
			curr = 0
		m = max(m, curr)
	print(m)
solve()


import sys
ans = 0
input()
for word in input().split():
	vol = 0
	for c in word:
		if 65 <= ord(c) <= 90:
			vol += 1
	ans = max(ans, vol)
print(ans)


n = int(input())
words = input().split()
ans = max((len(''.join(filter(lambda c: c.isupper(), word))) for word in words))
print(ans)


t = int(input())
l = list(input().split())
m = 0
for i in range(len(l)):
	n = sum((1 for c in l[i] if c.isupper()))
	if n > m:
		m = n
print(m)


n = int(input())
s = input().split()
mx = 0
cap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for word in s:
	volume = 0
	for letter in word:
		if letter in cap:
			volume += 1
	if volume > mx:
		mx = volume
print(mx)


from sys import stdin
length = int(stdin.readline())
string = stdin.readline().replace('\n', '')
allcaps = string.upper().split(' ')
string = string.split(' ')
f = 0
for i in range(len(string)):
	m = 0
	for a in range(len(string[i])):
		if allcaps[i][a] == string[i][a]:
			m += 1
	f = max(f, m)
print(f)


n = int(input())
a = list(map(str, input().split()))
l = []
for i in a:
	c = 0
	for j in i:
		d = ord(j)
		if d >= 65 and d <= 90:
			c += 1
	l.append(c)
print(max(l))


n = int(input())
s = input().split()
(ans, cur) = (0, 0)
for x in s:
	cur = 0
	for a in x:
		if 'A' <= a <= 'Z':
			cur += 1
	ans = max(ans, cur)
print(ans)


input()
words = input().split()
ans = 0
for item in words:
	cnt = 0
	for i in item:
		if i.isupper():
			cnt += 1
	ans = max(ans, cnt)
print(ans)


n = int(input())
s = input()
res = []
for word in s.split():
	res.append(sum((1 for c in word if c.isupper())))
print(max(res))


n = int(input())
s = str(input())
max_volume = 0
now_volume = 0
for i in s:
	if i == ' ':
		now_volume = 0
	elif i == i.upper():
		now_volume += 1
		max_volume = max(max_volume, now_volume)
print(max_volume)


l = input()
counter = int()
pr_counter = int()
word = input()
word = word.split(' ')
length = len(word)
for i in range(length):
	for j in range(len(word[i])):
		if word[i][j].isupper() == True:
			pr_counter = pr_counter + 1
	counter = max(counter, pr_counter)
	pr_counter = 0
print(counter)


n = int(input())
s = input()
s = s.split(' ')

def nb(ch):
	n = 0
	for j in ch:
		if j in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
			n += 1
	return n
max = 0
for i in s:
	x = nb(i)
	if x > max:
		max = x
print(max)


def volume(s):
	ans = 0
	for item in s:
		if item.isupper():
			ans += 1
	return ans
input()
s = input().split()
ans = 0
for item in s:
	ans = max(ans, volume(item))
print(ans)


n = int(input())
s = input().split()
max_ = 0
for i in range(len(s)):
	s[i] = str(s[i])
for i in s:
	k = 0
	for j in range(len(i)):
		if i[j] >= 'A' and i[j] <= 'Z':
			k += 1
	max_ = max(max_, k)
print(max_)


n = int(input())
s = input().split()
c = 0
mc = None
for i in s:
	c = 0
	for j in i:
		if j >= 'A' and j <= 'Z':
			c = c + 1
	if mc == None or mc < c:
		mc = c
print(mc)


def count_capitals(string):
	count = 0
	for letter in string:
		if letter.upper() == letter:
			count += 1
	return count
n = int(input())
words = [x for x in input().split()]
capitals = []
for word in words:
	capitals.append(count_capitals(word))
print(max(capitals))


n = int(input())
words = input().split(' ')
res = 0
for word in words:
	temp = sum((1 for c in word if c.isupper()))
	res = max(res, temp)
print(res)


n = int(input())
s = list(input().split())
f = 0
F = []
for i in range(len(s)):
	for j in s[i]:
		if 'A' <= j <= 'Z':
			f += 1
	F += [f]
	f = 0
print(max(F))


n = int(input())
line = input().split(' ')
Max = -1
for word in line:
	vol = 0
	for ch in word:
		if 'A' <= ch and ch <= 'Z':
			vol += 1
	if Max < vol:
		Max = vol
print(Max)


input()
stringlist = input().split()
maxx = 0
for string in stringlist:
	length = len(string)
	count = 0
	for i in range(length):
		if string[i].isupper():
			count += 1
	if count > maxx:
		maxx = count
print(maxx)


import math
n = int(input())
s = input()
array = []
result = []
for i in s.split():
	array.append(i)
for i in range(len(array)):
	counter = 0
	for j in range(len(array[i])):
		if ord(array[i][j]) < 91:
			counter += 1
	result.append(counter)
print(max(result))


alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
res = 0
res1 = 0
k = int(input())
strok = input()
for i in strok:
	if i == ' ':
		if res1 >= res:
			res = res1
			res1 = 0
		if res1 < res:
			res1 = 0
	if alp.find(i) != -1:
		res1 = res1 + 1
if res1 >= res:
	res = res1
print(res)


import functools as fn

def volume(str):
	return fn.reduce(lambda a, b: a + b, [1 if c.isupper() else 0 for c in str])
n = int(input())
ans = fn.reduce(lambda a, b: a if a > b else b, [volume(s) for s in input().split(' ')])
print(ans)


n = int(input())
ch = input()
l = []
i = 0
k = 0
while i < len(ch):
	if ch[i].isupper():
		k = k + 1
	if ch[i] == ' ':
		l.append(k)
		k = 0
	i += 1
l.append(k)
v = max(l)
print(v)


n = int(input())
s = input().split()
ans = 0
for i in s:
	tmp = 0
	for j in i:
		if ord('A') <= ord(j) <= ord('Z'):
			tmp += 1
	ans = max(tmp, ans)
print(ans)


n = int(input())
words = input().split(' ')
max_loudness = 0
for word in words:
	loudness = sum((char.isupper() for char in word))
	if loudness > max_loudness:
		max_loudness = loudness
print(max_loudness)


n = int(input())
l = [i for i in input().split(' ')]
ma = 0
for i in l:
	c = 0
	for j in i:
		if j.isupper() == True:
			c += 1
	if c > ma:
		ma = c
print(ma)


_ = int(input())
text = list(input().split())
ans = 0
for word in text:
	count = 0
	for char in word:
		if char >= 'A' and char <= 'Z':
			count += 1
	ans = max(ans, count)
print(ans)


n = int(input())
mxtext = 0
mxword = 0
for i in input():
	if i == ' ':
		mxtext = max(mxword, mxtext)
		mxword = 0
	elif ord(i) < 95:
		mxword += 1
print(max(mxtext, mxword))


n = int(input())
l = list(input().split())
maxup = 0
for i in range(len(l)):
	st = l[i]
	up = 0
	for ii in st:
		if ii.isupper():
			up += 1
	maxup = max(up, maxup)
print(maxup)


n = int(input())
li = [str(x) for x in input().split(' ')]
maxi = -12
for i in li:
	count = 0
	for j in i:
		if j.isupper():
			count += 1
	maxi = max(count, maxi)
print(maxi)


n = int(input())
s = input().split()
x = 0
for i in range(len(s)):
	counter = 0
	for j in s[i]:
		if j.isupper():
			counter += 1
	if counter > x:
		x = counter
print(x)


from string import *
n = input()
t = input()
lens = t.split()
uppers = []
for word in lens:
	u = [l for l in word if l.isupper()]
	uppers.append(u)
print(max([len(i) for i in uppers]))


n = int(input())
string = list(input().strip().split(' '))
count = 0
l1 = []
for i in string:
	count = 0
	for j in range(len(i)):
		if i[j].isupper():
			count = count + 1
	l1.append(count)
print(max(l1))


n = int(input())
print(max((sum(map(str.isupper, s)) for s in input().split())))


def shum(s):
	z = list()
	t = s.split()
	for elem in t:
		z.append(sum((1 for c in elem if c.isupper())))
	return max(z)
n = int(input())
print(shum(input()))


n = int(input())
string = input()
n_list = list()
cnt = 0
mx = 0
for i in string:
	if i != ' ':
		if i.isupper():
			cnt += 1
	else:
		cnt = 0
	if cnt > mx:
		mx = cnt
print(mx)


n = int(input())
s = list(input().split())
ans = 0
for w in s:
	t = 0
	for c in w:
		if c.isupper():
			t += 1
	ans = max(ans, t)
print(ans)


n = int(input())
s = list(map(str, input().split(' ')))
Max = 0
for i in range(len(s)):
	count = 0
	for j in s[i]:
		if j.isupper():
			count += 1
	Max = max(Max, count)
print(Max)


import math

def maximumToys(q):
	q = q + ' '
	max_W = 0
	temp = 0
	for i in range(0, len(q)):
		if q[i] >= 'A' and q[i] <= 'Z':
			temp += 1
		elif q[i] == ' ':
			if max_W <= temp:
				max_W = temp
			temp = 0
	return max_W
val = int(input())
tot = input()
print(maximumToys(tot))


def wordCaps(word):
	caps = list(filter(lambda x: x.isupper(), word))
	return len(caps)
l = input()
string = input()
vols = [wordCaps(word) for word in string.split(' ')]
print(max(vols))


a = int(input())
word = list(map(str, input().split(' ')))
lst = []
for c in range(len(word)):
	count = 0
	for i in range(len(word[c])):
		if word[c][i].isupper():
			count += 1
		lst.append(count)
print(max(lst))


n = int(input())
a = [i for i in input().split()]
print(max([len([c for c in e if c.isupper()]) for e in a]))


s = input()
t = 0
m = 0
s = input().split()
for i in s:
	for j in i:
		if j.isupper():
			t += 1
	if t > m:
		m = t
	t = 0
print(m)


n = int(input())
str_voulve = input().split()
answer = 0
number_upper_word = 0
for i in str_voulve:
	number_upper_word = 0
	for word in i:
		if word.upper() == word:
			number_upper_word += 1
	if number_upper_word > answer:
		answer = number_upper_word
print(answer)


from string import ascii_uppercase as upper
n = int(input())
str = input().split(' ')
cnts = []
for st in str:
	c = 0
	for s in st:
		if s in upper:
			c += 1
	cnts.append(c)
print(max(cnts))


n = int(input())
l = list(map(list, input().split()))
ma = 0
for i in l:
	z = 0
	for j in i:
		if ord(j) in range(65, 65 + 26):
			z += 1
	ma = max(z, ma)
print(ma)


def co(a):
	return sum(map(lambda x: 1 if x == x.upper() else 0, list(a)))
n = input()
text = input().split()
print(max(map(co, text)))


n = input()
s = list(input().split())
mt = -1
for k in s:
	mtt = 0
	for j in range(len(k)):
		if ord(k[j]) >= 65 and ord(k[j]) <= 90:
			mtt += 1
	mt = max(mtt, mt)
print(mt)


def f(s):
	r = 0
	for x in s:
		if x.isupper():
			r += 1
	return r
n = int(input())
s = map(lambda x: x.strip(), input().split())
w = list(map(f, s))
res = max(w)
print(res)


n = input()
words = input().split()
ans = 0
for word in words:
	ans = max(sum((1 for c in word if c.isupper())), ans)
print(ans)


n = int(input())
line = input()
vol = 0
max = 0
for e in line:
	if e.isupper():
		vol += 1
	if e == ' ':
		if vol > max:
			max = vol
		vol = 0
if vol > max:
	max = vol
print(max)


def main_function():
	n = int(input())
	s = [i for i in input().split(' ')]
	max_count = 0
	for i in s:
		internal_conter = 0
		for j in i:
			if j.isupper():
				internal_conter += 1
		if internal_conter > max_count:
			max_count = internal_conter
	return str(max_count)
print(main_function())


_ = input()
s = input().split()
n = 0
for i in s:
	m = 0
	for j in i:
		if j in 'QWERTYUIOPASDFGHJKLZXCVBNM':
			m += 1
	if m > n:
		n = m
print(n)


n = int(input())
s = list(input())
s = ''.join(s).split()
lst = []
for j in s:
	cnt = 0
	for i in j:
		if i.isupper():
			cnt += 1
	lst.append(cnt)
print(max(lst))


import re
n = int(input())
l = list(map(str, input().split()))
ans = 0
for i in l:
	temp = len(re.findall('[A-Z]', i))
	ans = max(temp, ans)
print(ans)


def g(word):
	return len([c for c in word if c.isupper()])
n = input()
print(max([g(w) for w in input().split()]))


import sys
n = int(input())
string = input().split()
cnt2 = 0
for char in string:
	cnt = 0
	for letter in char:
		if ord(letter) >= 65 and ord(letter) <= 90:
			cnt += 1
	if cnt > cnt2:
		cnt2 = cnt
print(cnt2)


def ans(s):
	sum = 0
	for i in range(0, len(s), 1):
		c = s[i]
		if c.isupper():
			sum += 1
	return sum
t = int(input())
s = str(input())
k = s.split(' ')
d = 0
m = 0
for i in k:
	d = ans(i)
	m = max(d, m)
print(m)


n = int(input())
t = list(map(str, input().split()))
m = 0
for i in t:
	s = 0
	for j in i:
		if j.isupper():
			s += 1
	if s > m:
		m = s
print(m)


n = int(input())
s = [i for i in input().split(' ')]
ma = 0
for i in range(len(s)):
	c = 0
	for j in range(len(s[i])):
		if s[i][j].isupper():
			c += 1
	if ma < c:
		ma = c
print(ma)


import string
input()
a = input().split()
max = 0
for word in a:
	sum = 0
	for i in range(len(word)):
		if word[i].isupper():
			sum += 1
	if sum > max:
		max = sum
print(max)


def uppers(a):
	cont = 0
	for i in a:
		if i.isupper():
			cont += 1
	return cont

def g():
	_ = int(input())
	print(max(list(map(uppers, input().split()))))
g()


n = int(input())
s = input()
k = 0
ans = 0
words = s.split(' ')
for w in words:
	k = 0
	for j in range(len(w)):
		if w[j].isupper():
			k += 1
	ans = max(k, ans)
print(ans)


input()
m = 0
for word in input().split(' '):
	temp_m = 0
	for ch in word:
		if ord(ch) <= 90:
			temp_m += 1
	if temp_m > m:
		m = temp_m
print(m)


import string
n = int(input())
up = []
for word in input().split():
	up.append([c for c in word if c in string.ascii_uppercase])
print(max(map(len, up)))


n = int(input())
a = list(map(str, input().split(' ')))
b = []
c = 0
for i in range(len(a)):
	for j in range(len(a[i])):
		if a[i][j].isupper() == True:
			c += 1
	b.append(c)
	c = 0
print(max(b))


import math
import bisect
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from collections import Counter
I = lambda : int(input())
tup = lambda : map(int, input().split())
lst = lambda : list(map(int, input().split()))
t = 1
while t:
	n = I()
	test = input().split()
	volume = []
	for ele in test:
		count = 0
		for i in ele:
			if i.isupper():
				count += 1
		volume.append(count)
	print(max(volume))
	t -= 1


n = int(input())
s = list(input().split())
d = []
for x in s:
	c = 0
	for i in x:
		if i != ' ' and 65 <= ord(i) <= 90:
			c += 1
	d.append(c)
print(max(d))


l = []
c = 0
n = int(input())
f = input().split()
for i in f:
	for k in i:
		if ord(k) >= 65 and ord(k) < 91:
			c += 1
	l.append(c)
	c = 0
print(max(l))


input()
ans = 0
for str in input().split():
	temp = 0
	for char in str:
		if char.isupper():
			temp += 1
	ans = max(ans, temp)
print(ans)


a = int(input())
n = input()
l = []
t = 0
l.insert(t, 0)
for i in range(0, a):
	if ord(n[i]) >= 65 and ord(n[i]) <= 90:
		l[t] += 1
	if ord(n[i]) == 32:
		t += 1
		l.insert(t, 0)
print(max(l))


def zag(ch, s):
	for i in s:
		if ch == i:
			return 1
n = int(input())
s = input()
a = [i for i in s.split()]
maxx = 0
m = 0
alph = 'QWERTYUIOPASDFGHJKLZXCVBNM'
for el in a:
	for i in el:
		if zag(i, alph) == 1:
			m += 1
	if m > maxx:
		maxx = m
	m = 0
print(maxx)


n = int(input().strip())
letters = input().strip().split(' ')
maxm = 0
for l in letters:
	s = 0
	for i in l:
		if i.isupper():
			s += 1
	maxm = max(maxm, s)
print(maxm)


n = input()
a = input().split()
ans = max((sum([1 for j in i if j.isupper()]) for i in a))
print(ans)


_ = input()
inp = list(input().split())
arr = []
for x in inp:
	temp = sum(map(str.isupper, x))
	arr.append(temp)
print(max(arr))


input()
s = input().split()
x = 0
for i in s:
	k = 0
	for j in i:
		if j <= 'Z' and j >= 'A':
			k += 1
	if k > x:
		x = k
print(x)


import string
x = int(input())
n = input()
l = n.split()
emp = []
alpha = string.ascii_uppercase

def string(s):
	c1 = 0
	for ss in s:
		if ss in alpha:
			c1 += 1
	return c1
for s in l:
	emp.append(string(s))
print(max(emp))


Upper = 'QWERTYUIOPASDFGHJKLZXCVBNM'
ie = int(input())
mxv = [0, 0]
str = input()
for char in str:
	if char == ' ':
		mxv[1] = 0
	if char in Upper:
		mxv[1] += 1
		if mxv[1] > mxv[0]:
			mxv[0] = mxv[1]
print(mxv[0])


length = int(input())
words = input().split(' ')
count = 0
for w in words:
	c = 0
	for l in w:
		if l.isupper():
			c += 1
	if count < c:
		count = c
print(count)


size = int(input())
st = str(input())
counter = 0
maximal = 0
for i in range(0, size):
	if st[i] < 'a' and st[i] != ' ':
		counter += 1
	if st[i] == ' ' or i == size - 1:
		if maximal < counter:
			maximal = counter
		counter = 0
print(maximal)


n = int(input())
b = []
k = 0
a = list(map(str, input().split()))
for i in range(len(a)):
	for j in range(len(a[i])):
		p = a[i][j].upper()
		if a[i][j] == p:
			k += 1
	b.append(k)
	k = 0
print(max(b))