Last active
August 29, 2015 14:11
-
-
Save omas/61d67b5f5a4a0b82bab1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| process.stdin.resume(); | |
| process.stdin.setEncoding('utf8'); | |
| process.stdin.on('data', function (chunk) { | |
| var answers = {'1':0,'2':0,'3':0,'4':0}; | |
| var lines = chunk.toString().split('\n'); | |
| var len = parseInt(lines.shift(),10); | |
| lines.toString().trim().split('').slice(0,len) | |
| .forEach(function(v){ | |
| answers[v]++; | |
| }); | |
| var result = (function(o){ | |
| var max = 0; | |
| var min = len; | |
| for (var key in o) { | |
| min = Math.min(o[key],min); | |
| max = Math.max(o[key],max); | |
| } | |
| return [max,min]; | |
| }(answers)); | |
| console.log(result.join(" ")); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment