题解 | #字符个数统计#
字符个数统计
https://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50
#include <iostream> #include <string> #include <vector> using namespace std; bool IsInStr(char s, vector<char> LeftArry) { for(int i=0; i<LeftArry.size();++i) { if(s==LeftArry[i]) { return true; } } return false; } int main() { string s; getline(cin,s); int count = 0; vector<char> LeftArry; for(int i=0; i<s.length();++i) { if(!IsInStr(s[i],LeftArry)) { count++; LeftArry.push_back(s[i]); } } cout<<count<<endl; } // 64 位输出请用 printf("%lld")