Iterate till last most * from last
for ( int z = 0 ; z < int ( suff . size ( ) ) && int ( S [ i ] . size ( ) ) - 1 - z > last ; z ++ ) { if ( suff [ z ] != S [ i ] [ int ( S [ i ] . size ( ) ) - 1 - z ] ) { return " * " ; } }