Driver code
public static void main ( String [ ] args ) { String str = " geeksforgeeks " ; int index = firstRepeating ( str ) ; if ( index == - 1 ) System . out . printf ( " Either ▁ all ▁ characters ▁ are ▁ " + " distinct ▁ or ▁ string ▁ is ▁ empty " ) ; else System . out . printf ( " First ▁ Repeating ▁ character " + " ▁ is ▁ % c " , str . charAt ( index ) ) ; } }