We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f819d93 + ed0d5ec commit a8524e9Copy full SHA for a8524e9
Advanced/1.Stacks, Queues, Tuples and Sets/Tuples and Sets - Exercise/04. Count Symbols.py
@@ -1,9 +1,9 @@
1
-lines = int(input())
+symbols = tuple(sorted([char for char in input()])) # makes a tuple of every single character
2
3
-periodic_table = set()
+counted_characters = [] # checks if a character is already counted
4
5
-for element in range(lines):
6
- chemical_elements = input().split()
7
- [periodic_table.add(elem) for elem in chemical_elements]
+for symbol in symbols:
8
9
-print('\n'.join(periodic_table))
+ if symbol not in counted_characters:
+ print(f"{symbol}: {symbols.count(symbol)} time/s")
+ counted_characters.append(symbol)
0 commit comments