#K35452. Count Friends

    ID: 25534 Type: Default 1000ms 256MiB

Count Friends

Count Friends

Given (N) people and (M) friendship records, each record represents a friendship between person (u) and person (v). Note that if (u = v) (a self-loop), it counts as one friendship. Also, if a friendship appears multiple times, each occurrence should be counted separately. Your task is to compute the number of friends each person has from person 1 to person (N).

inputFormat

The input is given via standard input (stdin) in the following format:

  • The first line contains two integers (N) and (M) where (1 \le N \le 10^5) and (0 \le M \le 10^5).
  • Each of the next (M) lines contains two integers (u) and (v) representing a friendship between person (u) and person (v).

outputFormat

Output a single line to standard output (stdout) with (N) integers. The (i)-th integer should represent the number of friends of person (i), with each integer separated by a single space.## sample

5 4
1 2
2 3
4 3
5 1
2 2 2 1 1