I have a large string like "wall hall to wall hall fall be", and I want to print longest strings. Then i want to know how many times all longest strings Is repeated?
For exampele,longest strings are:
wall Is repeated 2
hall Is repeated 2
fall Is repeated 1
This is my code: 
public void bigesttstring(String str){
    String[] wordsArray=str.split(" ");
    int n= str.trim().split("\\s+").length;
    int maxsize=0;
    String maxWord="";
    for(int i=0;i<wordsArray.length;i++){
        if(wordsArray[i].length()>maxsize){
             maxWord=wordsArray[i];
             maxsize=wordsArray[i].length();
        }
    }
    System.out.println("Max sized word is "+maxWord+" with  size "+maxsize);
}
But this code only prints "wall".
for count repeated String(i mean "maxWord"),this code write: 
int count=0; 
for(int i=0;i<wordsArray.length;i++){
    if(maxWord.equals(wordsArray[i])){
         count++;
    }
}
and for display other longest strings i have this code:
int k=0;
for(int i=0;i<wordsArray.length;i++){
    if(maxWord.equals(wordsArray[i])){
         continue;
    }
    if(maxsize==wordsArray[i].length()){
         k++;
    }
}
String[] other=new String[k];
int o=0;
for(int i=0;i<wordsArray.length;i++){
    if(maxWord.equals(wordsArray[i])){
         continue;
    }
    if(maxsize==wordsArray[i].length()){
         other[o]=wordsArray[i];
         o++;
    }
}  
I allowed to use this functions:
char char At(int i);               
int ComoareTo(String another string);              
boolean endsWith(String suffix);                     
int indexof();                      
int indexof(String str);                       
String substring();
char[] toCharArray();                            
String lowercase();         
And want another code like this for shortest strings.
 
     
     
     
     
    