Remove recurring digits in a given number | C # program to remove recurring digits from a given number ; Removes recurring digits in num [ ] ; int j = 0 ; Index in modified string ; Traverse digits of given number one by one ; Copy the first occurrence of new digit ; Remove repeating occurrences of digit ; Driver code
using System ; class GFG { static String removeRecurringDigits ( char [ ] num ) { int len = num . Length ; String s = " " ; for ( int i = 0 ; i < len ; i ++ ) { s += String . Join ( " " , num [ i ] ) ; while ( i + 1 < len && num [ i ] == num [ i + 1 ] ) { i ++ ; } } return s ; } public static void Main ( ) { char [ ] num = "1299888833" . ToCharArray ( ) ; Console . Write ( " Modified ▁ number ▁ is ▁ " + removeRecurringDigits ( num ) ) ; } }