#include <bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  string s;
  while (true) {
    cin >> s;
    if (cin.eof()) break;
    int tmp = 0;
    for (auto x : s) {
      if ('A' <= x && x <= 'Z') tmp++;
    }
    if (ans < tmp) ans = tmp;
  }
  cout << ans << endl;
  return 0;
}
