Answered step by step
Verified Expert Solution
Question
1 Approved Answer
NXT WAVB ? m larr PROGRAMMING FOUNDATIONS COURSE EXAM INSTRUCTIONS Description ( 1 ) Submissions MEDIUM Medium In Progress Helpful 0 In a laboratory, there
NXT
WAVB
larr PROGRAMMING FOUNDATIONS COURSE EXAM
INSTRUCTIONS
Description
Submissions
MEDIUM
Medium In Progress
Helpful
In a laboratory, there are various chemicals, and each chemical is
represented by a symbol such as etc. A student
has added chemicals to a jar one by one. He wants to know the
chemical mixture that he created using the chemicals.
Given a string of chemical symbols that represent the order in which
the student added the chemicals to the jar. Write a program to print a
string with each chemical symbol along with the number of times it is
added continuously. Join different chemical symbols using the plus
as shown in the sample output.
If a chemical is added only once without any repetition,
print the chemical name without its count.
Ex: "HHCOO"
Input
The input will be a single line containing a string representing a
sequence of chemical symbols.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started