#include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); string numbers = "0123456789"; string lower_case = "abcdefghijklmnopqrstuvwxyz"; string upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string special_characters = "!@#$%^&*()-+"; set sp(special_characters.begin(), special_characters.end()); int n; cin >> n; // for (int i = 0; i < n; i++) { string s; cin >> s; int m = 0; if (s.size() < 6) { m = max(m, 6 - (int)s.size()); } bool a = false; bool b = false; bool c = false; bool d = false; for (char ch : s) { if ('a' <= ch && ch <= 'z') a = true; if ('A' <= ch && ch <= 'Z') b = true; if ('0' <= ch && ch <= '9') c = true; if (sp.count(ch)) d = true; } m = max(m, (!a) + (!b) + (!c) + (!d)); cout << m << '\n'; // } }