Created
January 4, 2023 10:38
-
-
Save Hossara/d61b53a7a62f6389f7e3503890d22328 to your computer and use it in GitHub Desktop.
Program that get size and get list of space separated items and returns count of each items of list.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solve(list, size): | |
list = list.split(" ") | |
count_list = [None] * size | |
index = 0 | |
for i in list: | |
count = 0 | |
for j in list: | |
if i == j: | |
count += 1 | |
count_list[index] = str(count) | |
index += 1 | |
return ' '.join(count_list) | |
n = int(input()) | |
list = input() | |
while len(list.split(" ")) != n: list = input() | |
print(solve(list, n)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment