#include<stdio.h>
#include<string.h>
int main()
{
int T,count;
char a[10000],dp[30];
scanf("%d",&T);
while(T--)
{
count=0;
memset(dp,0,sizeof(dp));
scanf("%s",a);
int len=strlen(a);
for(int i=0;i<len;i++)
{
for(int j=count;j>=0;j--)
{
if(a[i]>dp[j])
{
dp[j+1]=a[i];
if(j==count)
count++;
break;
}
}
}
printf("%d\n",count);
}
return 0;
}
nyoj 17 最长子序列相关问题
最新推荐文章于 2019-09-15 16:47:42 发布