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').
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
c++, pleaaaaaase solve the equation

Transcribed Image Text:1/1
Sample Testcase 0
Input:
Space
Rocket
Output:
spa
c: 32
e: 44
Sample Testcase 1:
Input:
Engineering
Program
Output:
enine ein
g: 23
r: 71
g: 103
Sample Testcase 2:
Input:
Hi
Hi
Output:
none
h: 00
i: 11
Sample Testcase 3:
Input:
welcome
Spain
Output:
welcome
1 #include <iostream>
2
#include <string>
3 using namespace std;
4 int main() {
5
6789
*/
10 }
/* your code starts here
/* your code ends here */
return 0;
||

Transcribed Image Text:1/1
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:
1/0
• 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').
Program Input:
Two lines each containing any string.
Program Output:
The first line shows characters in str1 and not in
str2, all on the same line separated by white
space. N separate lines where each line has a
lette at is common between str1 but not in
str2 and its location (order starting from location
0) in str1 and str2.
=
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

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education