zoukankan      html  css  js  c++  java
  • 找出字符串中字符出现次数最的字符

    Code

                for (int i = 0; i < count ;i++)
                {
                    char c = testStr[i];
                    if (cCurrent != c && !list.Contains(c))
                    {
                        list.Add(c); //保存己经出现的字符
                        int scount = 0;
                        for (int j = 0; j < count; j++)//统计
                        {
                            if (testStr[j] == c)
                                scount++;
                        }
                        if (scount > max)
                        {
                            max = scount;
                            cCurrent = c;
                        }
                    }
                }
                Consolse.Write("最长字符串:"+ cCurrent.ToString() + ";长度为" + max.ToString());


     

  • 相关阅读:
    length()
    matlab mod()&rem()
    tf调试函数
    64位win7+PCL1.6.0+VS2010,64位win10+PCL1.6.0+VS2010
    pcl 1.8 + VS 2010 在win7 x64下的配置
    Qt在vs2010下的配置
    VS2010 win7 QT4.8.0,实现VS2010编译调试Qt程序,QtCreator静态发布程序
    [POI2012]ROZ-Fibonacci Representation (贪心)
    CF 666C & 牛客 36D
    数位dp练习
  • 原文地址:https://www.cnblogs.com/benwu/p/1486426.html
Copyright © 2011-2022 走看看