Question: Key goal: More practice with functions and strings and decision-making: Writing a function to analyze a string.] Another string function The number of unique characters
Key goal: More practice with functions and strings and decision-making: Writing a function to analyze a string.] Another string function The number of unique characters in a given string Write a C++function int unique (string word) which takes a string and counts up and returns the number of distinct symbols in the string For example, the call unique("MISSISSIPPI") should return 4 (for MLSP), and the call unique"aaalxx31xaa2aa") should return 5 (for a, 1x,3.2). Test your function on (at least) these two strings Bigidea As you focus on the i th character (word[@]) in the string (for example, suppose the word is MISSISSIPPI and i 4, so we are focusing on the second I in the word), search through the previous characters (word[O], wordl word[i-1]) and if this is the first time you'te seen this character increment a counter. Do this for each character in the word, ie, for i=0 through i-word length0-1.]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
