OJ-Problems-Source/HDOJ/2577_autoAC.cpp
2016-08-22 00:30:27 +08:00

37 lines
871 B
C++

#include<iostream>
using namespace std;
int main()
{
int T;
scanf("%d", &T);
getchar();
while(T--){
char s[2000];
gets(s);
int result = strlen(s), i, len;
len = result;
int lian_xu = 0;
for(i = 0; i < len; ++i){
if(s[i] >= 'A' && s[i] <= 'Z'){
if(lian_xu < 2){
result++;
}
lian_xu++;
}
else{
if(i+1 < len && lian_xu >= 2 ){
if(s[i+1] >= 'a' && s[i+1] <= 'z'){
lian_xu = 0;
}
else{
result++;
}
}
else lian_xu = 0;
}
}
printf("%d\n", result);
}
return 0;
}