// String串处理练习
public class A01
{
public static void main(String[] args)
{
String s = "abcdffff1ff234kkkkkxyztttwwwwwwwww";
// 求连续出现相同字母最多的那个字母和出现次数
int max = 0; // 假设最多是0次
char max_c = 'a';
// 遍历
int n = 1; // 表示某个字母连续的次数
for(int i=1; i<s.length(); i++)
{
if(s.charAt(i) == s.charAt(i-1))
{
n++;
}
else
{
if(n>max) max = n;
max_c = s.charAt(i-1);
n=1;
}
}
if(n>max)
{
max = n;
max_c = s.charAt(s.length()-1);
}
System.out.println(max + "," + max_c);
}
}