-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolution.py
More file actions
36 lines (28 loc) · 700 Bytes
/
solution.py
File metadata and controls
36 lines (28 loc) · 700 Bytes
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
input = open('data.txt', 'r').read()
# First part
counter = 0
for line in input.split("\n"):
check = True
spl = line.split(" ")
for word in spl:
if(spl.count(word)>1):
check = False
break
if check:
counter = counter+1
print("First part: "+str(counter))
# Second part
def SortLetters(s):
return "".join(sorted(s))
counter = 0
for line in input.split("\n"):
check = True
spl = line.split(" ")
sorted_spl = list(map(SortLetters, spl))
for word in sorted_spl:
if(sorted_spl.count(word)>1):
check = False
break
if check:
counter = counter+1
print("Second part: "+str(counter))