Strategic Bombing | 프로그래밍의 벗 PivotOJ
PivotOJ

Strategic Bombing

시간 제한: 1000ms메모리 제한: 128MB출처: CCC 2001 SeniorBOJ 6933

문제

The Enemy relies heavily on the transportation of supplies and personnel between the specific points A and B. Points A and B, as well as other points C, D, E, etc. are linked by a network of roads. Your mission, should you accept it, is to identify a single road that may be bombed in order to cut off all traffic between A and B.

In the input, each point is identified by a single upper-case letter (there is a maximum of 26). Each line of input identifies a pair of points connected by a road. The end of input is indicated by a line containing **. All roads are two-way, that is, road AC is the same as road CA. There is at most one road between any pair of points.

Your output should identify all roads such that bombing any one of them would halt all traffic between A and B. Your output should list the roads, one per line, followed by a line stating that There are n disconnecting roads., where nn is the number of such roads. If there is no such road, output There are 0 disconnecting roads..

예제

예제 1

입력
AC
AD
AE
CE
CF
ED
GF
BG
HB
GH
**
출력
CF
GF
There are 2 disconnecting roads.
코드를 제출하려면 로그인하세요.