$O(t\lg n)$
#include<cstdio> int t; char s[11]; int main() { scanf("%d", &t); while (t--) { scanf("%s", s); int r = 0; char c[99] = { 0, }; for (int i = 0; s[i]; i++) r += c[s[i]]++ == 0; printf("%d\n", r); } return 0; }
#include<cstdio> int t; char s[11]; int main() { scanf("%d", &t); while (t--) { scanf("%s", s); int r = 0; char c[99] = { 0, }; for (int i = 0; s[i]; i++) r += c[s[i]]++ == 0; printf("%d\n", r); } return 0; }
댓글 없음 :
댓글 쓰기