如何总结字符串前面的数字?例如,我有输入:
15 humpbacks
3 killer whales
2 sperm whales
19 belugas
2 humpbacks
2 sperm whales
7 killer whales
4 pygmy right whales
7 humpbacks
然后我想总结这些数字,就像这样:
24 humpbacks
10 killer whales
4 sperm whales
19 belugas
4 pygmy right whales