Problem:
Score : 300 points

Problem Statement

You are given an undirected connected graph with N vertices and M edges that does not contain self-loops and double edges.

The i-th edge (1 \leq i \leq M) connects Vertex a_i and Vertex b_i.

An edge whose removal disconnects the graph is called a bridge.

Find the number of the edges that are bridges among the M edges.

Notes

A self-loop is an edge i such that a_i=b_i (1 \leq i \leq M).

Double edges are a pair of edges i,j such that a_i=a_j and b_i=b_j (1 \leq i<j \leq M).

An undirected graph is said to be connected when there exists a path between every pair of vertices.

Constraints

2 \leq N \leq 50

N-1 \leq M \leq min(N(N−1)⁄2,50)

1 \leq a_i<b_i \leq N

The given graph does not contain self-loops and double edges.

The given graph is connected.

Input

Input is given from Standard Input in the following format:

N M
a_1 b_1
a_2 b_2
:
a_M b_M

Output

Print the number of the edges that are bridges among the M edges.

Sample Input 1

7 7
1 3
2 7
3 4
4 5
4 6
5 6
6 7

Sample Output 1

4

The figure below shows the given graph:

The edges shown in red are bridges. There are four of them.

Sample Input 2

3 3
1 2
1 3
2 3

Sample Output 2

0

It is possible that there is no bridge.

Sample Input 3

6 5
1 2
2 3
3 4
4 5
5 6

Sample Output 3

5

It is possible that every edge is a bridge.

Solution in JavaScript (node.js v5.12) (judge verdict: Accepted)

module.exports=function(r){var t={};function n(e){if(t[e])return t[e].exports;var o=t[e]={i:e,l:!1,exports:{}};return r[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=r,n.c=t,n.d=function(r,t,e){n.o(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:e})},n.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,t){if(1&t&&(r=n(r)),8&t)return r;if(4&t&&"object"==typeof r&&r&&r.__esModule)return r;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:r}),2&t&&"string"!=typeof r)for(var o in r)n.d(e,o,function(t){return r[t]}.bind(null,o));return e},n.n=function(r){var t=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(t,"a",t),t},n.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},n.p="",n(n.s=0)}([function(r,t,n){n(1)(n(2).readFileSync("/dev/stdin","UTF-8").split("\n"))},function(r,t,n){"use strict";function e(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,t){var n=[],e=!0,o=!1,u=void 0;try{for(var i,l=r[Symbol.iterator]();!(e=(i=l.next()).done)&&(n.push(i.value),!t||n.length!==t);e=!0);}catch(r){o=!0,u=r}finally{try{e||null==l.return||l.return()}finally{if(o)throw u}}return n}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}r.exports=function(r){for(var t=e(r[0].split(" ").map(function(r){return Number(r)}),2),n=t[0],o=t[1],u=[],i=0;i<n;i++)u.push([]);for(var l=0;l<o;l++){var a=e(r[l+1].split(" ").map(function(r){return Number(r)-1}),2),f=a[0],c=a[1];u[f].push(c),u[c].push(f)}var p=function(r){var t=r.length,n=new Array(t).fill(-1),e=new Array(t).fill(-1),o=[];return function t(u,i,l){n[u]=l++;e[u]=n[u];var a=!0;var f=!1;var c=void 0;try{for(var p,s=r[u][Symbol.iterator]();!(a=(p=s.next()).done);a=!0){var y=p.value;if(-1==n[y])e[u]=Math.min(e[u],t(y,u,l)),e[y]==n[y]&&o.push({from:u,to:y});else{if(i==y)continue;e[u]=Math.min(e[u],e[y])}}}catch(r){f=!0,c=r}finally{try{a||null==s.return||s.return()}finally{if(f)throw c}}return e[u]}(0,0,0),o}(u);console.log(p.length)}},function(r,t){r.exports=require("fs")}]);