code.cpp 417 B

12345678910
  1. /* Given two strings, create a function that returns the total
  2. * number of unique characters from the combined string.
  3. */
  4. int countUnique(std::string str1, std::string str2) {
  5. str1 += str2;
  6. std::sort (str1.begin(),str1.end());
  7. //str1.resize(std::distance(str1.begin(),std::unique (str1.begin(), str1.end())));
  8. return std::distance(str1.begin(),std::unique (str1.begin(), str1.end()));
  9. // return str1.size();
  10. }