def janken(_):
"""
:return:
>>> janken('gpgpgppppg')
6
>>> janken('ggggggggggggggg')
0
>>> janken('ccpcpppcccpppcppcpcc')
10
>>> janken('ggcgcgcggggcpgcggcgcggggcgcgcc')
0
"""
h = {}
for _ in _:
if h.get(_):
h[_] += 1
else:
h[_] = 1
if len(h) != 2: return 0
if not h.get('c'): return h['p']
if not h.get('g'): return h['c']
if not h.get('p'): return h['g']
if __name__ == '__main__':
import doctest
doctest.testmod()
ZGVmIGphbmtlbihfKToKICAgICIiIgogICAgOnJldHVybjoKICAgID4+PiBqYW5rZW4oJ2dwZ3BncHBwcGcnKQogICAgNgogICAgPj4+IGphbmtlbignZ2dnZ2dnZ2dnZ2dnZ2dnJykKICAgIDAKICAgID4+PiBqYW5rZW4oJ2NjcGNwcHBjY2NwcHBjcHBjcGNjJykKICAgIDEwCiAgICA+Pj4gamFua2VuKCdnZ2NnY2djZ2dnZ2NwZ2NnZ2NnY2dnZ2djZ2NnY2MnKQogICAgMAogICAgIiIiCiAgICBoID0ge30KICAgIGZvciBfIGluIF86CiAgICAgICAgaWYgaC5nZXQoXyk6CiAgICAgICAgICAgIGhbX10gKz0gMQogICAgICAgIGVsc2U6CiAgICAgICAgICAgIGhbX10gPSAxCgogICAgaWYgbGVuKGgpICE9IDI6IHJldHVybiAwCiAgICBpZiBub3QgaC5nZXQoJ2MnKTogcmV0dXJuIGhbJ3AnXQogICAgaWYgbm90IGguZ2V0KCdnJyk6IHJldHVybiBoWydjJ10KICAgIGlmIG5vdCBoLmdldCgncCcpOiByZXR1cm4gaFsnZyddCgoKaWYgX19uYW1lX18gPT0gJ19fbWFpbl9fJzoKICAgIGltcG9ydCBkb2N0ZXN0CgogICAgZG9jdGVzdC50ZXN0bW9kKCk=