-->
当前位置:首页 > 题库

PROGRAMMING:Statistics of favorite programs by class

Luz5年前 (2021-05-10)题库400
The school held a new year's party, class 1, class 2, two freshmen class statistics of their favorite programs. The program number is represented by a capital letter. The statistical results have been stored in two dictionaries. The key of the dictionary element is the program number, and the value of the element is the number of votes obtained by the corresponding program. No one needs to record the program that no one likes. For example, the dictionary {'Q': 10, 'a': 22, 'x': 28} indicates that there are 10 students who like Q program, 22 students who like a program, and 28 students who like x program. Enter the statistical results of the two classes. The combined statistical results are printed out in alphabetical order according to the program number( Note that if 10 students in class 1 like Q program and 15 students in class 2 like Q program, then after the merger, 25 students like Q program.)
###Input format:
Enter two dictionaries, one for each line. The key of the dictionary element is the program number (capital letters), and the value of the element is the number of votes obtained by the corresponding program.
###Output format:
Output the combined statistical results in alphabetical order. Each program occupies one line and is printed in the form of "program number: counting votes".
###Input example:
Here is a set of inputs. For example:
```in
{'Q':10,'A':22,'X':28}
{'A':30,'D':1,'Q':15,'B':13}
```
###Output example:
The corresponding output is given here. For example:
```out
A:52
B:13
D:1
Q:25
X:28
```







answer:If there is no answer, please comment