Driven code
S = " geeksforgeeks " NEW_LINE Len = len ( S ) NEW_LINE mat = [ [ 0 for i in range ( CHAR_SIZE ) ] for j in range ( MAX ) ] NEW_LINE precompute ( mat , S , Len ) NEW_LINE get = " No " NEW_LINE if ( query ( mat , " gg " , Len ) ) : NEW_LINE INDENT get = " Yes " NEW_LINE DEDENT print ( get ) NEW_LINE get = " No " NEW_LINE if ( query ( mat , " gro " , Len ) ) : NEW_LINE INDENT get = " Yes " NEW_LINE DEDENT print ( get ) NEW_LINE get = " No " NEW_LINE if ( query ( mat , " gfg " , Len ) ) : NEW_LINE INDENT get = " Yes " NEW_LINE DEDENT print ( get ) NEW_LINE get = " No " NEW_LINE if ( query ( mat , " orf " , Len ) ) : NEW_LINE INDENT get = " Yes " NEW_LINE DEDENT print ( get ) NEW_LINE