Panalphabetic window in a string | Java Program to check whether given string contain panalphabetic window or not ; Return if given string contain panalphabetic window . ; traversing the string ; if character of string is equal to ch , increment ch . ; if all characters are found , return true . ; Driver code
class GFG { static boolean isPanalphabeticWindow ( String s , int n ) { char ch = ' a ' ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . charAt ( i ) == ch ) ch ++ ; if ( ch == ' z ' + 1 ) return true ; } return false ; } public static void main ( String [ ] args ) { String s = " abujm ▁ zvcd ▁ acefc ▁ deghf " + " ▁ gijklem ▁ n ▁ o ▁ p ▁ pafqrstuvwxyzfap " ; int n = s . length ( ) ; if ( isPanalphabeticWindow ( s , n ) ) System . out . print ( " YES " ) ; else System . out . print ( " NO " ) ; } }