Write a program that takes two strings str1 and str2 from the user and prints the characters that appear in str1 and do not appear in str2 in a single line. It also prints all common characters between str1 and st2 and the character location in str1 and str2 one per line. Each input string is taken from a separate line. IMPORTANT NOTES Please follow the following guidelines when you print the output: • str1 is the first entered string and str2 is the second entered string. • The order of the characters in the output must be in the same order of their appearance in str1 and str2. • Characters in str1 and not in str2 should be printed on one line separated be a single space. If no character satisfies this rule, then the code must output none (all small letters). Each one of the common characters should be printed on a separate line. • When a common character appears at multiple indices in str2, the lowest index is printed. For example, in sample test case 1, the common character 'r' appears at index 1 and index 4 of string Program and the output shows only the lowest index (i.e. 1). • When a common character appears at multiple indices in str1, a separate line must be printed for each appearance. For example, in sample test case 1, the common character 'g' appears at index 2 and index 10 of string Engineering and the output shows 'g' twice according to its order in the string. • The application is not case-sensitive which means that the capital letter and the small letter of the character are treated the same.(i.e. 'C' = 'c').
Write a program that takes two strings str1 and str2 from the user and prints the characters that appear in str1 and do not appear in str2 in a single line. It also prints all common characters between str1 and st2 and the character location in str1 and str2 one per line. Each input string is taken from a separate line. IMPORTANT NOTES Please follow the following guidelines when you print the output: • str1 is the first entered string and str2 is the second entered string. • The order of the characters in the output must be in the same order of their appearance in str1 and str2. • Characters in str1 and not in str2 should be printed on one line separated be a single space. If no character satisfies this rule, then the code must output none (all small letters). Each one of the common characters should be printed on a separate line. • When a common character appears at multiple indices in str2, the lowest index is printed. For example, in sample test case 1, the common character 'r' appears at index 1 and index 4 of string Program and the output shows only the lowest index (i.e. 1). • When a common character appears at multiple indices in str1, a separate line must be printed for each appearance. For example, in sample test case 1, the common character 'g' appears at index 2 and index 10 of string Engineering and the output shows 'g' twice according to its order in the string. • The application is not case-sensitive which means that the capital letter and the small letter of the character are treated the same.(i.e. 'C' = 'c').
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 3PE
Related questions
Question
c++, pleaaaaaase solve the equation
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 4 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr