Write a
If the first letter is a vowel, add “way” to the end.
For example, if the user inputs “Erin” for the first name and “Jones” for the last name, then the program should create a new string with the text “Erinway Onesjay” and print it.
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Mechanics of Materials (10th Edition)
Starting Out with C++: Early Objects (9th Edition)
Starting Out with Python (4th Edition)
Starting Out With Visual Basic (8th Edition)
Web Development and Design Foundations with HTML5 (8th Edition)
HEAT+MASS TRANSFER:FUND.+APPL.
- Q1__;. A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers. Given a string s, return true if it is a palindrome, or false otherwise. Example 1: Input: s = "A man, a plan, a canal: Panama" Output: true Explanation: "amanaplanacanalpanama" is a palindrome. Example 2: Input: s = "race a car" Output: false Explanation: "raceacar" is not a palindrome..arrow_forwardQ1: Write a program that asks the user to enter their first name and their last name,separated by a space. Break the input string up into two strings, one containing thefirst name and one containing the last name. You can do that by using the indexOf()subroutine to find the position of the space, and then using substring() to extracteach of the two names. Also output the number of characters in each name andoutput the user’s initials. (The initials are the first letter of the first name togetherwith the first letter of the last name.) A sample run of the program should looksomething like this:Please enter your first name and last name, separated bya space.? Mary SmithYour first name is Mary, which has 4 charactersYour last name is Smith, which has 5 charactersYour initials are MSarrow_forwardwrite a program that prompts the user toenter a string and displays the number of vowels and consonants in the string. Assume lettersA, E, I, O, U (or a, e, i, o, u) as the vowels.1. Prompt the user for a String. (Note: The user input String may contain spaces)2. Print the number of vowels and consonants in the String. The count displayed mustaccount for all the vowels and consonants in the String regardless of case (upper orlower case). You must use a loop in your solution.Hint: charAt(index) and length() method for the String, toUpperCase(ch) (ortoLowerCase(ch)), isLetter(ch) method for the Character is helpful for thisassignment3. The output from the program must be enclosed in quotes as shown below in the samplerun of the program.arrow_forward
- PART 2:Write a program that accepts as input a sentence in which all the words are run together, but the first character of each word is uppercase. Convert the sentence to a string in which the words are separated by spaces and only the first word starts with an uppercase letter. For example, the string “StopAndSmellTheRoses.” would be converted to “Stop and smell the roses.” If the word is “I”, leave it as an uppercase I. Also check if the sentence ends with a “.”(period). If it does not, add a period at the end of the sentence.You should use a method to perform the editing to the sentence.Print the original sentence and the converted version. You may do this in the method or in the main program, having returned the new string.Repeat this for as many lines as there are in the input file. Use at least 8 lines of data. Have some with only one word. Have some words with only one letter(a), and at least one time the word I in the middle of the sentence. Some should end with a “.” and some…arrow_forwardIn C++ write a program that prompts the user to enter three strings and then make a new string formed by concatenation of the three strings with space in between. Print the new string formed in output. Input- "Alpha", "Beta", "Gamma" Output- "Alpha Beta Gamma"arrow_forwardString personName is read from input. Output personName left aligned with a width of 6, followed by " Taylor". End with a newline. Ex: If the input is Juno, then the output is: Juno Taylorarrow_forward
- Write a code that determines if a string is a palindrome (can be read forward and backward with the same meaning); e.g. "civic", “elle", “madam" 66 22arrow_forwardIn programming you work with text, sometimes you need to determine if a given string starts with or ends with certain characters. You can use two string methods to solve this problem: .startswith() and .endswith()?arrow_forwardExercise 1: Ask the user to type a string. Count and display the number of vowels (a,e,i,o,u). Print the string with all the vowels removed. Exercise 2: Cows cost $10 each, sheep cost $1 each and 8 hens can be bought for $1. Write a program which will buy exactly 100 animals for exactly $100 containing all three types (not just 100 sheep!)arrow_forward
- Q: Create a program, longest.py, that has a function that takes one string argument and prints a sentence indicating the longest word in that string. If there is more than one word print only the first. Your print statement should read: “The longest word is x” Where x = the longest word. The word should be all lowercase. I have the correct code, but the out put should only print: "The longest word is x". In my case it asks me an input first which I don't need. string = input('Enter string:'). My question is to remove the 'Enter string:' from my code, so that I get the correct working prints with only: "The longest word is x". I tried to remove that, but could print. Thanks ------------------------------------------------------------------------------ def longestWord(): length = 0 x: longestWord() = '' for word in string.split(): if len(word) > length: length = len(word) x = wordreturn x*****string = input('Enter string:') **** (want to remove this part) x =…arrow_forwardin python String user_string is read from input with leading and trailing whitespaces. Remove any leading and trailing whitespaces in the string. If user_string contains the string 'Paint color:', lowercase all the characters in user_string. Otherwise, capitalize the first character in user_string. Finally, print out the resulting string.arrow_forwardIn C++ language.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education