题解 | #字符个数统计#利find+push_back实现
字符个数统计
https://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
#include <iostream> using namespace std; void CountDifferentChar(string s) { string res; for (char c : s) { if (res.find(c) == string::npos) { res.push_back(c); } } cout << res.size(); } int main() { string s; cin >> s; CountDifferentChar(s); return 0; } // 64 位输出请用 printf("%lld")