Write a function that determines if two strings are anagrams. The function should not be case sensitive and should disregard any punctuation or spaces. Two strings are anagrams if the letters can be rearranged to form each other. For example, “Eleven plus two” is an anagram of “Twelve plus one.” Each string contains one “v”, three “e’s”, two “l’s”, etc. Test your function with several strings that are anagrams and non-anagrams. You may use either the string class or a C-style string.
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Problem Solving with C++ (9th Edition)
Additional Engineering Textbook Solutions
Database Concepts (7th Edition)
Computer Science: An Overview (12th Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Starting out with Visual C# (4th Edition)
Database Concepts (8th Edition)
- Q5. Write a function called findString to determine if one character string exists inside another string. The first argument to the function should be the character string that is to be searched and the second argument is the string you are interested in finding. If the function finds the specified string, have it return the location in the source string where the string was found. If the function does not find the string, have it return -1. For example: For function, findString ("a chatterbox", "hat") It searches the string "a chatterbox" for the string "hat". Because "hat" does exist inside the source string, the function returns Location= 3 to indicate the starting position inside the source string where "hat" was found. Programming Language :- C Note: You are not allowed to use inbuilt string library functionarrow_forwardCreate a function that takes a string with at least one sentence in it and returns a string with the part(s) after the comma at the beginning of the sentence(s). Examples reverse LegoYoda ("Hit you with my stick, I shall.") ➡ "I shall hit you with my stick." reverse LegoYoda ("Rejected me, my crush has. Ketamine, I need.") "My crush has rejected me. I need ketamine." - reverseLegoYoda ("An alien, I am. Holding me captive in Area 51, the government : → "I am an alien. The government is holding me captive in Area 51."arrow_forwardplease code in python Write a function that receives a string and a number (n) as parameters and returns a new string that contains only every nth letter from the given string. print(everyNth('banana', 2)) # should return aaaprint(everyNth('carrot', 3)) # should return rtprint(everyNth('pear', 1)) # should return peararrow_forward
- You may assume that both of the input strings are 5 letters and all lowercase. Problem D. Durdle Game Using the function from the previous problem, write a function durdle_game(target) which takes in as an argument a single string that will be the target to guess, and lets the user attempt to guess the target word. Each time the user makes a guess, the function will print out the result of the previous function to tell the user how close they are. If the user guesses correctly, then the game is over. Have the function return the number of guesses that it took the user to get the correct answer.arrow_forward4 Write a program that prompts the user to input a string. The program then use the function substr to remove all the vowels from the string. For example if str = "There", then after removing all the vowels, str = "Thr". After removing all the vowels, output the string. Your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel.arrow_forwardin c programing with User-Defined Functions Remove all non-alphabetic characters Write a program that removes all non-alphabetic characters from the given input. Assume the input string will not exceed 50 characters. Ex: If the input is: -Hello, 1 world$! the output is: Helloworld The program must define and call a function named RemoveNonAlpha that takes two strings as parameters: userString and userStringAlphaOnly. userString is the user specified string from the program input. Function RemoveNonAlpha() then assigns userStringAlphaOnly with the user specified string without any non-alphabetic characters.void RemoveNonAlpha(char userString[], char userStringAlphaOnly[])arrow_forward
- use c code to Develop a function that gets two same length strings as parameters and reports the number of characters that they have different. For example, if the two strings are Str1: “Hello world! Happy Friday”Str2: “Hello Johny! happy friday” The function should return: Your strings are different in 7 places However, if the strings are exactly equal, it should just say Your strings are the same If the strings are not of the same length, the code should just say: The two strings are not of the same length! Hint: 1.compare the two strings character by character and report the differences 2.answer must have and show the outputarrow_forwardInstructions Write a program that uses the function is Palindrome given in Example 6-6 (Palindrome). Test your program on the following strings: madam, abba, 22, 67876, 444244, trymeuemyrt Modify the function isPalindrome of Example 6-6 so that when determining whether a string is a palindrome, cases are ignored, that is, uppercase and lowercase letters are considered the same. The isPalindrome function from Example 6-6 has been included below for your convenience. bool isPalindrome (string str) { int length = str.length(); for (int i = 0; i < length / 2; i++) { if (str[i] != str[length - 1 - i]) { return false; } // if } // for loop return true; }// isPalindrome Your program should print a message indicating if a string is a palindrome: madam is a palindromearrow_forwardPlease help I cant do it ,pleasearrow_forward
- Can you use Python programming language to to this question? Thanksarrow_forwardin C++ language, write a program Function 1: takes as input a string, ONE character, and an integer n, and returns true if the string contains that character EXACTLY an n number of times.Function 2: takes as input a string and TWO alphabatical characters c1 and c2, and returns true if all the string characters fall in the range between the two passed characters (exclusive) (You must make sure to order the characters first if c2 < c1 ).Function 3: takes as input a string and THREE alphabatical characters c1, c2 and c3. The function reorders the characters in asecnding order, such that c1 holds the smallest character and c3 holds the largest character. The function returns true if the string characters that fall between c1 and c2 (exclusive) is less than the string characters that fall between c2 and c3 (exclusive).arrow_forwardCreate a function that takes a number (int) and returns a corresponding string of dashes. Examples: num_to_dashes(1) ➞ "-" num_to_dashes(5) ➞ "-----" num_to_dashes(3) ➞ "---"arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning