If for any character indegree is not equal to outdegree then ordering is not possible
for ( int i = 0 ; i < M ; i ++ ) if ( in [ i ] != out [ i ] ) return false ; return isConnected ( g , mark , arr [ 0 ] . front ( ) - ' a ' ) ; }