// 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