Skip to content

Commit a8524e9

Browse files
authored
Update 04. Count Symbols.py #20
2 parents f819d93 + ed0d5ec commit a8524e9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
lines = int(input())
1+
symbols = tuple(sorted([char for char in input()])) # makes a tuple of every single character
22

3-
periodic_table = set()
3+
counted_characters = [] # checks if a character is already counted
44

5-
for element in range(lines):
6-
chemical_elements = input().split()
7-
[periodic_table.add(elem) for elem in chemical_elements]
5+
for symbol in symbols:
86

9-
print('\n'.join(periodic_table))
7+
if symbol not in counted_characters:
8+
print(f"{symbol}: {symbols.count(symbol)} time/s")
9+
counted_characters.append(symbol)

0 commit comments

Comments
 (0)