Last active
December 1, 2017 19:35
-
-
Save CraicOverflow89/bbb15b69d82c22d0845380514a43d613 to your computer and use it in GitHub Desktop.
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 | |
while(++ n < input.length) | |
{ | |
if(input[n - 1] == input[n]) total += Integer.parseInt(input[n].toString()) | |
} | |
// Render Result | |
println(total) | |
// NOTE: okay so my last and first char were the same, I manually added these :/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment