text: Print characters having even frequencies in order of occurrence | C # implementation of the approach ; Function to print the even frequency characters in the order of their occurrence ; To store the frequency of each of the character of the string ; Update the frequency of each character ; Traverse str character by character ; If frequency of current character is even ; Driver code
code: using System ; using System . Collections . Generic ; class GFG { static int SIZE = 26 ; static void printChar ( String str , int n ) { int [ ] freq = new int [ SIZE ] ; for ( int i = 0 ; i < n ; i ++ ) freq [ str [ i ] - ' a ' ] ++ ; for ( int i = 0 ; i < n ; i ++ ) { if ( freq [ str [ i ] - ' a ' ] % 2 == 0 ) { Console . Write ( str [ i ] ) ; } } } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; int n = str . Length ; printChar ( str , n ) ; } }