Panalphabetic window in a string | CPP 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 . ; Driven Program
#include <bits/stdc++.h> NEW_LINE using namespace std ; bool isPanalphabeticWindow ( char s [ ] , int n ) { char ch = ' a ' ; for ( int i = 0 ; i < n ; i ++ ) { if ( s [ i ] == ch ) ch ++ ; if ( ch == ' z ' + 1 ) return true ; } return false ; } int main ( ) { char s [ ] = " abujm ▁ zvcd ▁ acefc ▁ deghf ▁ gijkle " " ▁ m ▁ n ▁ o ▁ p ▁ pafqrstuvwxyzfap " ; int n = strlen ( s ) ; ( isPanalphabeticWindow ( s , n ) ) ? ( cout << " YES " ) : ( cout << " NO " ) ; return 0 ; }