{ "type": "code_options", "author": "csdn.net", "source": "solution.md", "exercise_id": "89d9e179bea44370ab0c829bb40b6b76", "keywords": "图算法,算法高阶,最小生成树,最小生成树的形成", "title": "找出字符串中出现最多的字母", "desc": [ { "content": "\nDescription\n钟Sir是一个迷信的(superstitious)家伙。他相信每一个字符串(string)里都有一个幸运字符。我们可以通过以下方法找到这个字符。例如,在字符串abbccc中,c 出现的次数最多,所以这个幸运字符就是 c 啦!(>_<)  (钟Sir的想法好简单啊…)\nInput\n第一行是测试数据的组数n,接下来的每组测试数据占一行,每行数据不超过1000个字符且非空。\n字符串里只含小写字母。\nOutput\n每组数据对应输出一行,包括出现次数最多的字符和该字符出现的次数,中间是一个空格。如果有多个字符出现的次数相同且最多,那么输出ASCII码最小的那一个字符。\nSample Input\n2\nabbccc\nadfadffasdf\nSample Output\nc 3\nf 4", "language": "markdown" } ], "answer": [ { "content": "", "language": "cpp" } ], "prepared": [ [ { "content": "", "language": "cpp" } ], [ { "content": "", "language": "cpp" } ], [ { "content": "", "language": "cpp" } ] ], "template": { "content": " #include \n#include\"stdio.h\"\nint main(void)\n{\n\tint n,i, z[26], max, xia;\n\tchar c[1050], ch;\n\tscanf(\"%d\",&n);\n\twhile(n>0)\n\t{\n\t\tn--;\n\t\tscanf(\"%s\", c);\n\t\tfor(i=0; i<26; i++)\n\t\t\tz[i]=0;\n\t\txia=strlen(c);\n\t\tfor(i=0; imax){ \n\t\t\tmax=z[i];\n\t\t\txia=i;\n\t\t}\n\t\tch='a'+xia;\n\t\tprintf(\"%c %d\\n\", ch, max);\n\t}\n\treturn 0;\n}", "language": "cpp" }, "node_id": "dailycode-41a61041f452440ba9cc47d98c9b5087", "license": "csdn.net", "created_at": 1637894160, "topic_link": "https://bbs.csdn.net/topics/600469966" }