#graph201. 割边
割边
Bridge Edges
Problem Description
You are given an undirected connected graph with vertices and edges. Output all bridge edges (cut edges) in increasing order of their index. Note: the edges are numbered starting from .
(A bridge / cut edge is an edge whose removal increases the number of connected components.)
Input Format
The first line contains two integers ().
The next lines each contain two integers , indicating an undirected edge. There are no self-loops, but there may be multiple edges.
Output Format
First output one integer: the number of bridge edges. Then on the next line, output the indices of the bridge edges in increasing order, separated by spaces.
Sample Input
7 8
1 2
2 3
3 4
2 5
4 5
5 6
5 7
5 7
Sample Output
2
1 6
Constraints
- No self-loops; multiple edges may exist