#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <vector>
#define mem(a, b) memset(a, b, sizeof(a))
using namespace std;
const int maxn = 10010, INF = 0x7fffffff;
int pre[maxn], low[maxn], iscut[maxn];
vector<int> G[maxn];
int dfs_clock, n;
int dfs(int u, int fa)
{
int lowu = pre[u] = ++dfs_clock;
int child = 0;
for(int i=0; i<G[u].size(); i++)
{
int v = G[u][i];
if(!pre[v])
{
child++;
int lowv = dfs(v, u);
lowu = min(lowv, lowu);
if(lowv >= pre[u])
iscut[u] = 1;
}
else if(pre[v] < pre[u] && v != fa)
lowu = min(lowu, pre[v]);
}
if(fa < 0 && child == 1) iscut[u] = 0;
low[u] = lowu;
return lowu;
}
void init()
{
for(int i=1; i<=n; i++) G[i].clear();
dfs_clock = 0;
mem(pre, 0);
mem(iscut, 0);
mem(low, 0);
}
int main()
{
int a, b;
char ch;
while(cin>> n && n)
{
int ret = 0;
init();
while(scanf("%d",&a) && a)
{
while(scanf("%d%c", &b, &ch))
{
G[a].push_back(b);
G[b].push_back(a);
if(ch == '
') break;
}
}
dfs(1,-1);
for(int i=1; i<=n; i++)
if(iscut[i]) ret++;
cout<< ret <<endl;
}
return 0;
}
自己选择的路,跪着也要走完。朋友们,虽然这个世界日益浮躁起来,只要能够为了当时纯粹的梦想和感动坚持努力下去,不管其它人怎么样,我们也能够保持自己的本色走下去。