标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 368 Accepted Submission(s): 243
解析:说了那么多,其实很简单,就是求有多少种字母。
#include <cstdio> #include <cstring> const int MAXN = 1e5+5; char s[MAXN]; bool vis[30]; int main() { int t, cn = 0; scanf("%d", &t); while(t--){ scanf("%s", s); memset(vis, 0, sizeof(vis)); int res = 0; for(int i = 0; s[i] != ‘\0‘; ++i){ if(!vis[s[i]-‘a‘]){ vis[s[i]-‘a‘] = true; ++res; } } printf("Case #%d: %d\n", ++cn, res); } return 0; }
标签:
原文地址:http://www.cnblogs.com/inmoonlight/p/5773467.html