1 answer

Please answer only if you know data structures question provide C++ code please 4. Write definition...

Question:

please answer only if you know
data structures question
provide C++ code please
4. Write definition of the function LetterCount() whose header is int LetterCount(string word) It returns the count of the di
4. Write definition of the function LetterCount() whose header is int LetterCount(string word) It returns the count of the distinct letters in word while ignoring case.

Answers

#include <iostream> #include <string>  using namespace std;  int LetterCount(string word) {     string distinct;      for (int i = 0; i < word.size(); ++i) { // go through each character of word         char ch = word[i];  // get character from word         if (ch >= 'A' && ch <= 'Z') // if character is upeprcase             ch = ch + 'a' - 'A';    // then convert it to lowercase          bool found = false; // set found to false         for (int j = 0; j < distinct.size(); ++j) { // go through all charcters of distinct             if (ch == distinct[j])  // if this character at word is already in distinct string                 found = true;   // set found to true         }          if (!found) {   // if this character is not found in distinct             distinct += ch; // then add it to distinct string         }     }      return distinct.size(); // finally return the length of distinct string }  int main() {     cout << LetterCount("Hellohowareyou") << endl;     return 0; } 

phpLIvnGT.png

.

Similar Solved Questions

1 answer
Im confused on how to do the first part, preparing the 4 financial statements, if allowed...
im confused on how to do the first part, preparing the 4 financial statements, if allowed i would also Appreciate if you would show me how to do the next step which would be preparing the closing entries thank you in advance! 3. 3) Below are the accounts for XYZ Company: Fees Eamed 750,000 D...
1 answer
Problem 4.(30 pts) Given the analog signal x(t) cos(2 cos(3t)+2 sin(4mt) A.(10 pts) Find the Nyquist...
Problem 4.(30 pts) Given the analog signal x(t) cos(2 cos(3t)+2 sin(4mt) A.(10 pts) Find the Nyquist frequency (sampling frequency) which guarantees That x() can be recovered from it's sampled version xIn] with no aliasing. B.(10 pts) If the sampling period of Ts 0.4 see is used identify all dis...
1 answer
A ship is sailing due north. At a certain​ point, the bearing of a lighthouse 5.4...
A ship is sailing due north. At a certain​ point, the bearing of a lighthouse 5.4 km away is N 39.8 degrees E. Later​ on, the captain notices that the bearing of the lighthouse has become  S 32.3 degrees E. How far did the ship travel between the two observations of the​ ...
1 answer
Randy Company produces tennis rackets. If the fixed cost per racket is $15 when 64,400 rackets...
Randy Company produces tennis rackets. If the fixed cost per racket is $15 when 64,400 rackets are produced, what is the fixed cost per racket when 34,500 rackets are produced?...
1 answer
Mail CNN E ESPN in Linkedin Amazon G Gmail National and Local M Gmail Yout 2.docx...
Mail CNN E ESPN in Linkedin Amazon G Gmail National and Local M Gmail Yout 2.docx BIU AA E EE 1. Identify the seven key factors that contributed to transforming medicine from a weak insecure, isolated trade into a profession of power and authority. 2. What was created in 1965, with the passage of Ti...
1 answer
Rose Company uses FIFO process costing and produces its finished product in 2 departments: Machining and...
Rose Company uses FIFO process costing and produces its finished product in 2 departments: Machining and Painting. The following information is available for the Painting Department for May: The beginning work in process inventory was $74,226 ($54,000 transferred-in costs and $20,226 conversion cost...
1 answer
In each reaction box, place the best reagent and conditions from the list below. pling In...
In each reaction box, place the best reagent and conditions from the list below. pling In each reaction box, place the best reagent and conditions from the list below. HBr CH3Br H2, Pt Br2 NaOH NaNH BH3 THF NBS, ROOR, hv H2, Lindlar's catalyst H202, NaOH, H20 NaBH4...
1 answer
5) Propose a synthesis of the following molecule, which will involve using an acetal protecting group,...
5) Propose a synthesis of the following molecule, which will involve using an acetal protecting group, forming a Grignard reagent and performing a nucleophilic attack on a separate carbonyl compound. This will be a multi-step synthesis....
1 answer
Automata Prove that regular languages are closed under difference, using an indirect proof (leveraging the closure...
Automata Prove that regular languages are closed under difference, using an indirect proof (leveraging the closure of other set operators)....
1 answer
Note: The answers are stated. I need the explanation for why C is as depicted. Please...
Note: The answers are stated. I need the explanation for why C is as depicted. Please thoroughly explain why C is as given. Thank you. A4Trait not scored for this generation A. What is the inheritance pattern of this trait? X-linked dominant B. what are the predicted phenotypes for the children A1, ...
1 answer
3 FBFDs 3 F ma REM:IA (Piston ,sn't rota-hq) The Dynamies Project In the engine system shown, 1-160 mm and b= 60 mm. Knowing that the crank AB rotates with a constant angular velocity of 12 r...
3 FBFDs 3 F ma REM:IA (Piston ,sn't rota-hq) The Dynamies Project In the engine system shown, 1-160 mm and b= 60 mm. Knowing that the crank AB rotates with a constant angular velocity of 12 rads/s clockwise. Determine all the reactionary forces as a function of θ and plot these forces as a...
1 answer
On May 1, Donovan Company reported the following account balances: Current assets Buildings & equipment (net)...
On May 1, Donovan Company reported the following account balances: Current assets Buildings & equipment (net) Total assets Liabilities Common stock Retained earnings Total liabilities and equities $ 90,000 220,000 $ 310,000 $ 60,000 150,000 100,000 $ 310,000 On May 1. Beasley paid $400,000 in st...
1 answer
Give and example of the standard equation of an ellipse with center at (0,0) whose major...
Give and example of the standard equation of an ellipse with center at (0,0) whose major axis is vertical....
1 answer
The U.S. government subsidizes flood insurance because those who want to buy it live in the...
The U.S. government subsidizes flood insurance because those who want to buy it live in the flood plain area and cannot get it at reasonable rates. What inefficiency does this create?...
1 answer
Suppose 31.34% of small businesses experience cash flow problems in their first 5 years. A consultant...
Suppose 31.34% of small businesses experience cash flow problems in their first 5 years. A consultant takes a random sample of 637 businesses that have been opened for 5 years or less. What is the probability that greater than 30.86% of the businesses have experienced cash flow problems? Question 2 ...
1 answer
The “Village Enlightenment” that transformed rural America in the early 19th century and opened it up...
The “Village Enlightenment” that transformed rural America in the early 19th century and opened it up to change, including the purchase of art, was the result of: the growth of the southern cotton economy a. the expansion of transportation networks b. the election of a new federal govern...