text: Print the most occurring character in an array of strings | C # program to print the most occurring character in an array of Strings ; Function to print the most occurring character ; Creating a hash of size 26 ; For loop to iterate through every String of the array ; For loop to iterate through every character of the String ; Incrementing the count of the character in the hash ; Finding the character with the maximum count ; Driver code ; Declaring Vector of String type
code: using System ; class GFG { static void findMostOccurringChar ( string [ ] str ) { int [ ] hash = new int [ 26 ] ; for ( int i = 0 ; i < str . Length ; i ++ ) { for ( int j = 0 ; j < str [ i ] . Length ; j ++ ) { hash [ str [ i ] [ j ] - 97 ] ++ ; } } int max = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) { max = hash [ i ] > hash [ max ] ? i : max ; } Console . Write ( ( char ) ( max + 97 ) + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { string [ ] str = { " animal " , " zebra " , " lion " , " giraffe " } ; findMostOccurringChar ( str ) ; } }