From d178fa815cba58c2e1c18bc51f5282ed91922c42 Mon Sep 17 00:00:00 2001 From: Titouan Rigoudy Date: Sat, 27 Sep 2014 01:25:01 -0400 Subject: [PATCH] Solved Gem Stones --- gem_stones/gem_stones.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 gem_stones/gem_stones.py diff --git a/gem_stones/gem_stones.py b/gem_stones/gem_stones.py new file mode 100644 index 0000000..c3cff06 --- /dev/null +++ b/gem_stones/gem_stones.py @@ -0,0 +1,24 @@ +#!/usr/bin/python3 + +# https://www.hackerrank.com/challenges/halloween-party + +import sys + +def count_gems(str, gems): + tmp = [ False ] * 26 + for c in str: + tmp[ord(c) - 97] = True + for i in range(26): + if not tmp[i]: + gems[i] = False + +def main(): + N = int(sys.stdin.readline()) + gems = [ True ] * 26 + for _ in range(N): + str = sys.stdin.readline().strip() + count_gems(str, gems) + print(sum(gems)) + +if __name__ == '__main__': + main() \ No newline at end of file