Tally a multiset
mediumQuestion 472A multiset<int> named ms already holds the values 2, 5, 2, 8, 5, 2. Print each distinct value exactly once, in ascending order, one per line, in the form: the value, a space, the letter x, and the number of copies (no space between x and the number). Every line ends with a newline, including the last one.
Expected output
2 x3 5 x2 8 x1
= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
STL ContainersSets
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your output
Run your code to see the output here...
Test cases
Run your code to see test case results.