Created
January 5, 2015 06:42
-
-
Save omas/39654ef2f7ecdf525236 to your computer and use it in GitHub Desktop.
This file contains 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 lines = chunk.split('\n'); | |
var len = parseInt(lines.shift(),10); | |
var result = (function(words) { | |
return words.map(function(word) { | |
return word.split('').reverse().join(''); | |
}) | |
.sort() | |
.map(function(word) { | |
return word.split('').reverse().join(''); | |
}) | |
.join('\n'); | |
}(lines.slice(0,len))); | |
console.log(result); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment