Introduction
For those not familiar with steam - or at least this particular aspect:
Often on peoples' profiles, people leave comments saying either "+rep _____" or "-rep _____". These are an unofficial means of showing whether you think someone in the community has a good or a bad reputation, for a number of reasons. Such comments look like:
+rep a good player
+rep helpful
-rep hacker
-rep scammer
Task
The program must take input through any consensual way. The input consists of a string with optional newlines (\n
). At the very start of each line, '+rep '
or '-rep '
might be present. The rest of the line can be discarded. If the line doesn't start with '+rep '
or '-rep '
(note the trailing space), the line should be ignored.
The program then must keep a total reputation score. Starting at 0
, this score should be incremented on every line that starts with '+rep '
and decremented on every line that starts with '-rep '
.
This result should be output in any agreed-upon way.
Test cases
Input:
+rep fast trade
+rep nice person
-rep too good
Output: 1
Input:
-rep hacker
-rep scammer
-rep was mean
Output: -3
Input:
first
i don't like him
+rep good at cs go
Output: 1
Input (note the lack of a trailing space on the third line):
+rep +rep
hi +rep
-rep
Output: 1
Input:
+ rep
Output: 0
Input:
+rep like
-thing
Output: 1
Bonus
I don't even know if it's possible, but bonus points if you can somehow get these comments from Steam.
0
, not1
. \$\endgroup\$