Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Build a dictionary, where the strings are the keys, and the values are the sum total of all of the values you've seen for that

image text in transcribed

Build a dictionary, where the strings are the keys, and the values are the sum total of all of the values you've seen for that line. Once you hit the end of the input, print out the sum for each string, one per line. Sort your lines by the values, in reverse order. If there are two strings with the same value, then sort those strings by the string itself. So, if your input looks like this: 10 asdf jkl 3 asdf -1 17 foobar bbbb 17 then your output should be: bbbb 17 foobar 17 asdf 9 jkl 3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions