Skip to content

Instantly share code, notes, and snippets.

@TheGag96
Created January 27, 2017 19:27
Show Gist options
  • Save TheGag96/58cee9b6dd7f602ea0445f6176679925 to your computer and use it in GitHub Desktop.
Save TheGag96/58cee9b6dd7f602ea0445f6176679925 to your computer and use it in GitHub Desktop.
import std.stdio, std.range, std.algorithm;
static immutable int[] KEYS = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 1, 2, 3, 4];
void main() {
stdin.byLine.dropOne.each!((i, line) => writefln("Case #%d: %d", i+1, line.map!(c => (c == ' ' ? 1 : KEYS[c - 'a'])).sum));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment