Java program to find the character that appears the most number of times in a String?

前端 未结 8 997
慢半拍i
慢半拍i 2020-12-22 13:03

So here\'s the code I\'ve got so far...

import java.util.Scanner;
class count{
    public static void main(String args[]){
        Scanner s=new Scanner(Syst         


        
8条回答
  •  心在旅途
    2020-12-22 13:21

    First in initialize the arr[] i.e

    for(int i=0;i

    then :

    for(int j= 0;j<=len-1;j++){
      count=0;
      for(int k=0;k<=len-1;k++){
          if(ch[j]==ch[k]){
              arr[j]= count++;
        }
      }
    }
    

提交回复
热议问题