Driver code
public static void main ( String [ ] args ) { char str [ ] = " baaabab " . toCharArray ( ) ; char pattern [ ] = " * * * * * ba * * * * * ab " . toCharArray ( ) ; char pattern [ ] = " ba * * * * * ab " ; char pattern [ ] = " ba * ab " ; char pattern [ ] = " a * ab " ; if ( strmatch ( str , pattern , str . length , pattern . length ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; char pattern2 [ ] = " a * * * * * ab " . toCharArray ( ) ; if ( strmatch ( str , pattern2 , str . length , pattern2 . length ) ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }