#include <iostream>
#include <string>
using namespace std;
int main() {
int f[105], d, sum = 0;
cin >> d;
string a;
for (int i = 1; i <= d; i++) {
cin >> a;
sum = 0;
sum = a.length();
if (a[0] >= 'A' && a[0] <= 'Z') {
sum++;
}
for (int j = 0; j <= a.length() - 2; j++) {
if (a[j] >= 'a' && a[j] <= 'z' && a[j + 1] >= 'A' && a[j + 1] <= 'Z' ||
a[j] >= 'A' && a[j] <= 'Z' && a[j + 1] >= 'a' && a[j + 1] <= 'z') {
sum++;
}
}
f[i] = sum;
}
for (int i = 1; i <= d; i++) {
cout << f[i] << endl;
}
return 0;
}
求帮助
好久没练了
都生疏了