Smallest substring which is not empty
for ( int i = 0 ; i < v . size ( ) ; i ++ ) { if ( v . get ( i ) != " " ) { if ( ans . charAt ( 0 ) >= v . get ( i ) . charAt ( 0 ) ) { ans = v . get ( i ) ; } } } return ans ; }