Driver Code
public static void main ( String args [ ] ) { String str = " geeksforgeeks " ; int index = firstNonRepeating ( str ) ; if ( index == Integer . MAX_VALUE ) System . out . print ( " Either ▁ all ▁ characters ▁ are ▁ " + " repeating ▁ or ▁ string ▁ is ▁ empty " ) ; else System . out . print ( " First ▁ non - repeating ▁ character " + " ▁ is ▁ " + str . charAt ( index ) ) ; } }