Driver code
$ str = " geeksforgeeks " ; $ index = firstNonRepeating ( $ str ) ; if ( $ index == -1 ) echo " Either ▁ all ▁ characters ▁ are " . " ▁ repeating ▁ or ▁ string ▁ is ▁ empty " ; else echo " First ▁ non - repeating ▁ " . " character ▁ is ▁ " . $ str [ $ index ] ; ? >