blob: 2634d9c0779bc2728bf70514ff7a77502304ed17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
import sys
# task implementation
# the return value will be printed
def task_1( args ):
words1 = []
words2 = []
first = True
for w in args:
if w == '|':
first = False
if first:
words1.append( w )
else:
words2.append( w )
single1 = []
single2 = []
for w in words1:
if len( list( filter( lambda x: x == w, words1 ) ) ) == 1:
if not w in single1:
single1.append( w )
for w in words2:
if len( list( filter( lambda x: x == w, words2 ) ) ) == 1:
if not w in single2:
single2.append( w )
counting = 0
for w in single1:
if w in single2:
counting += 1
return counting
# invoke the main without the command itself
if __name__ == '__main__':
print( task_1( sys.argv[ 1: ] ) )
|