#include<stdio.h>
#include<string.h>
int main()
{
int t,sum,ans,da,i;
char a[2050];
scanf("%d",&t);
while(t--)
{
scanf("%s",a);
sum=ans=0;
da=0;
for(i=0;a[i]!=0;i++)
{
if(a[i]>='A'&&a[i]<='Z'&&a[i+1]>='A'&&a[i+1]<='Z'&&da==0)
{
da=1;
ans++;
}
if(a[i]>='a'&&a[i]<='z'&&(a[i+1]>='a'&&a[i+1]<='z'||a[i+1]==0)&&da==1)
{
da=0;
ans++;
}
if(a[i]>='A'&&a[i]<='Z')
{
if(da==0)
ans+=2;
else
ans++;
}
else if(a[i]>='a'&&a[i]<='z')
{
if(da==0)
ans++;
else
ans+=2;
}
}
if(da)
{
ans++;
}
printf("%d\n",ans);
}
return 0;
}
HDU - 2577
最新推荐文章于 2019-01-08 03:40:36 发布