NETWORK
A telecommunications company is planning a new telephone network. The network will connect locations, numbered from to . The lines between the locations are bidirectional. From each location, one can call any other location, but the connection may not be direct and may pass through other intermediate locations acting as switches.
Sometimes, some locations experience power outages. When this happens, the locations cannot function either to make or receive calls or as switches. The company found that sometimes power outages cause connectivity issues between locations that still have power. A location is considered critical when, in the event of a power outage, there is at least one pair of other locations that can no longer connect to each other.
Write a program to find all critical locations in the network.
Input (network.in)
The first line of input will consist of two natural numbers and : the number of locations and the number of direct connections between them. Each of the next lines will contain two numbers, defining the ends of a direct connection.
Output (network.out)
The output should consist of a single line containing only one natural number: the number of critical locations in the network.
Constraints
Time limit: 1 sec.
Memory limit: 64 MB.
Examples of Input - Output
1st
STDIN (network.in)
5 4
2 5
4 5
5 3
1 5
STDOUT (network.out)
1
2nd
STDIN (network.in)
6 5
3 2
2 1
2 5
5 4
6 5
STDOUT (network.out)
2
Explanation of the examples: In the first example, the only critical location is . In the second example, there are two critical locations, and .
Comments