Driver program to test above function
int main ( ) { char str [ ] = " geeksforgeeks " ; int index = firstNonRepeating ( str ) ; if ( index == -1 ) printf ( " Either ▁ all ▁ characters ▁ are ▁ repeating ▁ or ▁ " " string ▁ is ▁ empty " ) ; else printf ( " First ▁ non - repeating ▁ character ▁ is ▁ % c " , str [ index ] ) ; getchar ( ) ; return 0 ; }