Created
December 1, 2017 19:34
-
-
Save CraicOverflow89/ece2fc083f39d2c63889156628ecd317 to your computer and use it in GitHub Desktop.
AOC1B
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
fun main(args: Array<String>) | |
{ | |
// Fetch Input | |
val input = input() | |
// Iterate Chars | |
var total = 0 | |
var n = 0 | |
do | |
{ | |
var pos = n + input.length / 2 | |
if(pos > input.length - 1) pos = pos - input.length | |
if(input[pos] == input[n]) total += Integer.parseInt(input[n].toString()) | |
} | |
while(++ n < input.length) | |
// Render Result | |
println(total) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment