Skip to content

Instantly share code, notes, and snippets.

@CraicOverflow89
Last active December 1, 2017 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CraicOverflow89/bbb15b69d82c22d0845380514a43d613 to your computer and use it in GitHub Desktop.
Save CraicOverflow89/bbb15b69d82c22d0845380514a43d613 to your computer and use it in GitHub Desktop.
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