We form a substring from that maximum character index till end and check if its greater that maxstring
for ( int i = 0 ; i < index . Count ; i ++ ) { if ( str . Substring ( index [ i ] ) . CompareTo ( maxstring ) > 0 ) { maxstring = str . Substring ( index [ i ] ) ; } } return maxstring ; }