count number of distinct characters in a string c++ code example
Example: finding no of unique characters in a string c++
int countDistinct(string s)
{
unordered_map<char, int> m;
for (int i = 0; i < s.length(); i++) {
m[s[i]]++;
}
return m.size();
}