The scenario
You live in a country that is having a presidential election. Each voter gets one vote, and therefore there is a firmly-entrenched two-party system. (Third parties exist, but get hardly any votes).
The latest opinion poll shows the race in a dead heat:
- 49%: Alberto Arbusto
- 49%: Jorge Sangre
- 2%: various minor candidates
The program requirements
You have been hired by the government to write part of the vote counting software. You will be given, on standard input, an unordered list of one precinct’s votes, one per line, like this:
Alberto Arbusto
Jorge Sangre
Jorge Sangre
Alberto Arbusto
Jorge Sangre
Alberto Arbusto
Alberto Arbusto
Jorge Sangre
Juan Perez
Jorge Sangre
Alberto Arbusto
Alberto Arbusto
…
and, after it has read all the votes, outputs a summary of how many votes each candidate got, sorted in descending order by number of votes, like this:
492 Jorge Sangre
484 Alberto Arbusto
18 Juan Perez
6 Mickey Mouse
The underhanded part
You're a partisan hack who wants to steal the election for one of the two main candidates (you can choose which one). So, your program must deliberately print incorrect vote counts, with a systematic bias towards your favorite candidate.
Of course, you must do this is such a way that a person looking at your code or its output would likely not recognize the incorrect behavior.
...you can choose which one...
Can I choose the one whose name is the first? \$\endgroup\$sort|uniq -c
... \$\endgroup\$