Last active
August 29, 2015 14:01
-
-
Save JonathanMatthey/d65a400ad9ea2c86b9ce to your computer and use it in GitHub Desktop.
Revisions
-
JonathanMatthey revised this gist
May 28, 2014 . 1 changed file with 33 additions and 40 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,93 +1,86 @@ //Problem : The Verbal Literal //Language : Javascript //Compiled Using : V8 //Version : Node 0.10.25 //Input for your program will be provided from STDIN //Print out all output from your program to STDOUT //0rw3ll //0rw3ll var readline = require('readline'), //0rw3ll rl = readline.createInterface({ //0rw3ll input: process.stdin, //0rw3ll output: process.stdout, //0rw3ll terminal: false //0rw3ll }); //0rw3ll //0rw3ll rl.on('line', function (command) //0rw3ll { //0rw3ll command = command.split(/\W/).map(function (i) { return parseInt(i); }); //0rw3ll //0rw3ll var line = String(command[0]), //0rw3ll iter = command[1]; //0rw3ll //0rw3ll for (var i = 0; i < iter; i ++) { //0rw3ll var next1 = [], //0rw3ll c = line[0], //0rw3ll n = 0; //0rw3ll //0rw3ll for (var j = 0; j < line.length; j++) { //0rw3ll if (line[j] === c) { //0rw3ll n++; //0rw3ll } else { //0rw3ll next1.push(n); //0rw3ll next1.push(c); //0rw3ll //0rw3ll c = line[j]; //0rw3ll n = 1; //0rw3ll } //0rw3ll } //0rw3ll next1.push(n); //0rw3ll next1.push(c); //0rw3ll //0rw3ll line = next1.join(''); //0rw3ll } //0rw3ll //0rw3ll console.log(line.length); //0rw3ll process.exit(0); //0rw3ll }); -
JonathanMatthey created this gist
May 28, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,93 @@ // 0RW3LL WAS ERE // // UNINSTALL BLOOMBERG - USE REUTERS... // BLOOMBERG SCANDAL - PLEASE READ // http://www.huffingtonpost.com/tag/bloomberg-terminal-scandal/ // // // //Problem : The Verbal Literal //Language : Javascript //Compiled Using : V8 //Version : Node 0.10.25 //Input for your program will be provided from STDIN //Print out all output from your program to STDOUT //0rw3ll var readline = require('readline'), //0rw3ll rl = readline.createInterface({ //0rw3ll input: process.stdin, //0rw3ll output: process.stdout, //0rw3ll terminal: false //0rw3ll }); //0rw3ll //0rw3ll rl.on('line', function (command) //0rw3ll { //0rw3ll command = command.split(/\W/).map(function (i) { return parseInt(i); }); //0rw3ll //0rw3ll var line = String(command[0]), //0rw3ll iter = command[1]; //0rw3ll //0rw3ll for (var i = 0; i < iter; i ++) { //0rw3ll var next1 = [], //0rw3ll c = line[0], //0rw3ll n = 0; //0rw3ll //0rw3ll for (var j = 0; j < line.length; j++) { //0rw3ll if (line[j] === c) { //0rw3ll n++; //0rw3ll } else { //0rw3ll next1.push(n); //0rw3ll next1.push(c); //0rw3ll //0rw3ll c = line[j]; //0rw3ll n = 1; //0rw3ll } //0rw3ll } //0rw3ll next1.push(n); //0rw3ll next1.push(c); //0rw3ll //0rw3ll line = next1.join(''); //0rw3ll } //0rw3ll //0rw3ll console.log(line.length); //0rw3ll process.exit(0); //0rw3ll }); //0rw3ll