Question: C++ programming- Please help 1.Return the number of times two consecutive characters occur in str. // // numberOfPairs () returns 0 // numberOfPairs (abc) returns
C++ programming- Please help 1.Return the number of times two consecutive characters occur in str. // // numberOfPairs ("") returns 0 // numberOfPairs ("abc") returns 0 // numberOfPairs ("aabbcc") returns 3 // numberOfPairs ("!!!") returns 2 // numberOfPairs ("mmmm") returns 3 // numberOfPairs ("mmOmm") returns 2 // int numberOfPairs (std::string str) { // TODO: Complete this function 2) howSwedish // // ABBA is a band, they have many songs including Dancing Queen, and // Fernando. ABBA is actually a Swedish band, so if we wanted to find // out howSwedish a std::string is, we could simply find out how many times // the std::string contains the std::string "abba". We want to look for this // str::string in a case insensitive manner. So "abba" counts, and so // does "aBbA". We also want to check for overlapping abba's such as // in the std::string "abbAbba" that contains "abba" twice. // // howSwedish("") returns 0 // howSwedish("ABB") returns 0 // howSwedish("AbBa") returns 1 // howSwedish("AbBa a B b a") returns 1 // howSwedish("!abbABba!") returns 2 // howSwedish("abbAbba") returns 2 // int howSwedish(std::string str) { // TODO: Complete this function }
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
