'commit'
This commit is contained in:
18
TangDou/LanQiaoBei/LanQiao14STEMA202208/3_0.cpp
Normal file
18
TangDou/LanQiaoBei/LanQiao14STEMA202208/3_0.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user