#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  int cnt = 0, ans = 0;
  while (cin >> a) {
    for (int i = 0; i < a.length(); i++) {
      if (a[i] >= 'A' && a[i] <= 'Z') cnt++;
    }
    ans = max(ans, cnt);
    cnt = 0;
  }
  cout << ans;
  return 0;
}
