Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@zsrinivas
Created March 21, 2015 10:24
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 zsrinivas/071aca1636248cb0e13c to your computer and use it in GitHub Desktop.
Save zsrinivas/071aca1636248cb0e13c to your computer and use it in GitHub Desktop.
spoj PEBBLE - Pebble Solver | http://www.spoj.com/problems/PEBBLE/
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# pylint: disable=invalid-name,missing-docstring,bad-builtin
import sys
def main():
for i, pebble in enumerate(sys.stdin.read().split()):
curch = 1
count = 0
for ch in map(int, pebble):
if ch == curch:
curch = 1 - ch
count += 1
print 'Game #{}: {}'.format(i + 1, count)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment