Given a string str = "question and answer, is the network of professional free knowledge quiz platform to help build industry practitioners to solve the problems encountered in learning and work, so that the builders no longer have doubts";
Write a function to find the most occurrences of the characters in a string
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceconsoleapplication1{classProgram {Static voidMain (string[] args) { stringstr ="heavenly Question and answer, is the heavenly network's professional free knowledge quiz platform to help construction industry practitioners to solve the problems encountered in the study and work, so that builders no longer have doubts"; Dictionary<Char,int> dic =Newdictionary<Char,int>(); for(inti =0; I < Str. Length; i++) { if(!DiC. ContainsKey (Str[i])) {Dic[str[i]]=1; } Else{Dic[str[i]]++; } } intMaxValue =DiC. Values.max (); foreach(CharCinchDiC. Keys) {if(dic[c]==MaxValue) {Console.WriteLine (c); Console.readkey (); } } } }}
See the written questions