Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save TheDarkMac/eb4a9d5fe8bc37d44da9760dbd853b00 to your computer and use it in GitHub Desktop.
Save TheDarkMac/eb4a9d5fe8bc37d44da9760dbd853b00 to your computer and use it in GitHub Desktop.
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
const L = parseInt(readline());
const H = parseInt(readline());
const T = readline();
const tetxtToASCIIStartAtZero = T.split('').map(e => e.toUpperCase().charCodeAt(0) - 65);
console.error(tetxtToASCIIStartAtZero)
for (let i = 0; i < H; i++) {
const ROW = readline();
let result = "";
for(let b = 0; b < tetxtToASCIIStartAtZero.length;b++){
let k = 0;
for(let j = L*tetxtToASCIIStartAtZero[b] ; j < tetxtToASCIIStartAtZero[b]*L+L ;j++){
if(tetxtToASCIIStartAtZero[b] < 0){
result = result + ROW[ROW.length-L + k];
k++;
}else{
result = result + ROW[j];
}
}
}
console.log(result)
}
/*
console.log("### ")
console.log("# ")
console.log("## ")
console.log("# ")
console.log("### ")
*/
// Write an answer using console.log()
// To debug: console.error('Debug messages...');
//console.error(tetxtToASCIIStartAtZero)
//console.log('answer');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment