题意:
按字母出现的顺序编号,问最长上升子序列。
思路:
最长为26,出现一个新的字母就加上,答案为字母的种数,无聊的题目。
code:
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
using namespace std;
const int N=1e5+5;
string s;
int st[28];
int main()
{
int T;
scanf("%d",&T);
for (int ca=1;ca<=T;ca++){
memset(st,0,sizeof(st));
cin>>s;int ans=0;
for (int i=0;i<s.size();i++){
st[s[i]-'a']++;
if (st[s[i]-'a']==1) ans++;
}
printf("Case #%d: %d\n",ca,ans);
}
}