Driven Program
public static void main ( String args [ ] ) { String S = " geeksforgeeks " ; int len = S . length ( ) ; int [ ] [ ] mat = new int [ MAX ] [ CHAR_SIZE ] ; precompute ( mat , S , len ) ; String get = query ( mat , " gg " , len ) ? " Yes " : " No " ; System . out . println ( get ) ; get = query ( mat , " gro " , len ) ? " Yes " : " No " ; System . out . println ( get ) ; get = query ( mat , " gfg " , len ) ? " Yes " : " No " ; System . out . println ( get ) ; get = query ( mat , " orf " , len ) ? " Yes " : " No " ; System . out . println ( get ) ; } }