#C2222. Number of Friends

    ID: 45515 Type: Default 1000ms 256MiB

Number of Friends

Number of Friends

In this problem, you are given \(N\) students and \(M\) pairs of friendships. Each friendship connects two students, and the relation is bidirectional, meaning if student \(i\) is a friend of student \(j\), then student \(j\) is also a friend of student \(i\). Your task is to compute the number of friends each student has.

Details: The input starts with two integers \(N\) (the number of students) and \(M\) (the number of friendship pairs). This is followed by \(M\) lines where each line contains two integers \(A\) and \(B\) representing a friendship between student \(A\) and student \(B\). Students are numbered from 1 to \(N\).

Example: For instance, if \(N = 4\), \(M = 3\), and the friendship pairs are (1, 2), (2, 3), and (3, 4), then the friend counts for students 1 to 4 are: [1, 2, 2, 1].

inputFormat

The first line contains two space-separated integers \(N\) and \(M\).

Each of the following \(M\) lines contains two integers \(A\) and \(B\), indicating that student \(A\) and student \(B\) are friends.

outputFormat

Output a single line containing \(N\) integers. The \(i^{th}\) integer should be the number of friends of student \(i\).

## sample
4 3
1 2
2 3
3 4
1 2 2 1