c++
Write a function Count_m_z that takes a string as an input parameter argument and counts the number of m, n, o, ... z characters in it. The function returns an integer value for the number of times those 14 lowercase letters appear in the input string.
Your function should be named Count_m_z
Your function should take one string parameter
Your function should return the number of m, n, o, ... z characters as an integer
Your function should not print/output anything
Edge Cases
If the string is empty, return -1
If there are no m, n, o, ... z characters in the string, return -2
Examples
string "muenzinger" → return 6
string "mUENZINGER" → return 1
#include <iostream>
#include <string>
using namespace std;
//function to count the number of m, n, o, ... z
characters
int Count_m_z(string str)
{
//declare and initialization of variable
int count = 0, length = 0;
//check the input string character by character
while (str[length] != '\0')
{
//check with ASCII value
//ASCII value of m is 109
//ASCII value of z is 122
if(str[length]>108 && str[length]<123)
{
count++;
}
length++;
}
//if string length is zero
if(length==0)
return -1;
//if number of m, n, o, ... z characters is zero
if(count==0)
return -2;
return count;
}
int main()
{
//variable declaration
string str;
str = "muenzinger";
//display the result
cout<<endl<<"The number of m, n, o, ... z characters:
"<<Count_m_z(str);
return 0;
}
OUTPUT:

c++ Write a function Count_m_z that takes a string as an input parameter argument and counts...
project-8a Write a function named count_letters that takes as a parameter a string and returns a dictionary that tabulates how many of each letter is in that string. The string can contain characters other than letters, but only the letters should be counted. The string could even be the empty string. Lower-case and upper-case versions of a letter should be part of the same count. The keys of the dictionary should be the upper-case letters. If a letter does not...
C++ Write a function parseScores which takes a single input argument, a file name, as a string. Your function should read each line from the given filename, parse and process the data, and print the required information. Your function should return the number of student entries read from the file. Empty lines do not count as entries, and should be ignored. If the input file cannot be opened, return -1 and do not print anything. Your function should be named...
Define a function that counts the number of lowercase and uppercase letters in an input C-String. DO NOT DEFINE TWO SEPARATE FUNCTIONS. (in C++)
#Write a function called check_formula. The check_formula #function should take as input one parameter, a string. It #should return True if the string holds a correctly #formatted arithmetic integer formula according to the rules #below, or False if it does not. # #For this problem, here are the rules that define a #correctly-formatted arithmetic string: # # - The only characters in the string should be digits or the five arithmetic operators: +, -, *, /, and =. Any other...
Define a Python function named getResponse() that takes a string as its only argument and returns a new string. If the argument ends with a question mark and has an even number of characters, the function should return the string "Yes". If the argument ends with a question mark and contains an odd number of characters, the function should return the string "No". If the argument ends with an exclamation point, the function should return the string "Wow". Otherwise, the...
Write function vowelCount2() that takes a string as input and counts and prints the number of occurrences of vowels in the string. Vowels are a, e, i, o, and u. Implement the code in the file lab5.py. This function is very similar to the function of the problem 4.25, but the vowel information which did not appear in the string should not be printed. The printing order of the vowels is a, e, i, o, u. e.g.) >>> lab5.vowelCount2(‘augustana’) a,...
Write function vowelCount() that takes a string as input and counts and prints the number of occurrences of vowels in the string. >>> vowelCount('Le Tour de France') a, e, i, o, and u appear, respectively, 1, 3, 0, 1, 1 times.
10. replaceSubstring Function Write a function named replaceSubstring. The function should accept three C-string or string object arguments. Let's call them string1, string2, and string3. It should search string for all occurrences of string2. When it finds an occurrence of Programming Challenges string2, it should replace it with string. For example, suppose the three arguments have the following values: stringt: "the dog jumped over the fence" string 2 "the" string3: "that" With these three arguments, the function would return a...
Write an LC-3 program (starting at memory location 0x3000) to take a string as input and then output information about this string. The end of the string will be denoted with the "#" character. Once the "#" has been found, output the following in order: 1) The letter “u” followed by the number of uppercase letters in the string (A-Z) 2) The letter “l” followed by the number of lowercase letters in the string (a-z) 3) The letter “n” followed...
Python help def palindrome_word: ''' (str) -> bool The parameter is a string consisting only of lowercase alphabetic letters. It may or may not be a palindrome. Return True if and only if the parameter is a palindrome. The empty string is considered to be a palindrome. ''' def palindrom_phrase: ''' (str) -> bool The parameter is a string that may or may not be a palindrome. Return True if and only if the parameter is a palindrome, independent of...