题解 | #字符个数统计#
字符个数统计
https://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
#include <array> #include <iostream> #include <numeric> #include <string> using namespace std; int main() { int a, b; array<int, 128> list={0}; string s; getline(cin, s); // cout << s << endl; for(auto ch:s){ if (list[(int)ch] == 0) { list[(int)ch]=1; } } cout<<accumulate(list.begin(), list.end(), 0); } // 64 位输出请用 printf("%lld")