Exercise: add numbers
Given a file like this:
examples/regex/grades1.txt
Foo:1 Foo:2 Foo:3 Foo:4 Foo:5 Foo:6 Foo:7 Foo:8 Bar:23 Foo:23 Foo:11 Foo:9 Bar:8 Zorg:7
- Add up the scores for each name and print the result.
Foo : 79 Bar : 31 Zorg : 7
- Make it work also on a file that looks like this:
examples/regex/grades2.txt
# Let's start with Foo:1 Foo:1 Foo: 2 Foo :3 Foo : 4 Foo:5 Foo: 6 Foo :7 Foo : 8 # Let's start Bar with : 23 Bar:23 Foo: 23 Foo: 11 Foo : 9 Bar: 8 Zorg: 7