Skip to content

Instantly share code, notes, and snippets.

@ooade
Created September 6, 2016 20:29
Show Gist options
  • Save ooade/5ebc97c9254898fdedd9f9969646a900 to your computer and use it in GitHub Desktop.
Save ooade/5ebc97c9254898fdedd9f9969646a900 to your computer and use it in GitHub Desktop.
Mars Exploration 1
function main() {
let N = readLine()
let S = N.match(/.{1,3}/g);
let R = 'SOS'.repeat(N.length / 3).match(/.{1,3}/g);
let count = 0;
for (let i in S) {
for (let j in S[i]) {
if (S[i][j] !== R[i][j]) {
count++;
}
}
}
console.log(count);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment