aboutsummaryrefslogtreecommitdiff
path: root/challenge-026/paulo-custodio/python/ch-1.py
blob: d26cb6d4a32edbf3eabaebba1c18ab1db41e9ca1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/python3

# Challenge 026
#
# Task #1
# Create a script that accepts two strings, let us call it, "stones" and
# "jewels". It should print the count of "alphabet" from the string "stones"
# found in the string "jewels". For example, if your stones is "chancellor" and
# "jewels" is "chocolate", then the script should print "8". To keep it simple,
# only A-Z,a-z characters are acceptable. Also make the comparison case
# sensitive.

import sys

def count(letters, word):
    letters = set([x for x in letters])
    return len(list(filter(lambda x: x in letters, [x for x in word])))

print(count(sys.argv[1], sys.argv[2]))