You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
string str = "cacd";
|
|
// 3
|
|
int bucket[26];
|
|
int cnt;
|
|
int main() {
|
|
//桶计数
|
|
for (int i = 0; i < str.size(); i++) bucket[str[i] - 'a']++;
|
|
for (int i = 0; i < 26; i++)
|
|
if (bucket[i]) cnt++;
|
|
|
|
cout << cnt << endl;
|
|
|
|
// t.size()!=cnt
|
|
return 0;
|
|
} |