Graphs: coding problems
Write a program that reads the input and prints the answer. Run checks it against every test, including hidden ones.
0 of 7 solved
A school club keeps a list of friendships. Every friendship is mutual, so the pair
0 1means student 0 is friends with student 1 and the other way round.Print how many friends each student has, from student 0 up to student n - 1, on one line separated by single spaces. If the same pair appears twice in the list, that is two friendships, and both copies count.
**Constraints:** 1 <= n <= 2000, 0 <= m <= 20000. No student is friends with themselves.
Input. First line: n and m. Next m lines: two student numbers u and v.
Output. One line with n integers: the number of friends of students 0 to n - 1.
Example 1 input
4 3 0 1 1 2 1 3
Output
1 3 1 1
Example 2 input
3 0
Output
0 0 0