-->
当前位置:首页 > 题库

PROGRAMMING:Creating undirected graph with adjacency matrix representation

Luz5年前 (2021-05-10)题库402
The adjacency matrix representation is used to create an undirected graph G, and the degree of each vertex is output in turn.
###Input format:
In the first line of input, two integers i (0 < I ≤ 10) and J (J ≥ 0) are given, which are the number of vertices and sides of graph G respectively.
Input the information of the second row vertex. Each vertex can only be represented by one character.
Enter j rows in turn, each row with a vertex attached to the edge.
###Output format:
Output the degree of each vertex in turn, and there is no last space at the end of the line.
###Input example:
```in
5 7
ABCDE
AB
AD
BC
BE
CD
CE
DE
```
###Output example:
```out
2 3 3 3 3
```







answer:If there is no answer, please comment