I want to be able find the maximum amount of times a substring occurs consecutively , this substring is not already predefined but it can be anything.
public static int countWordsOccurence(String line){
//return the occurence
}
For example inputing "raacdrunrunruntryingtotrackrunrun"
would return 3 because run occurs 3 times in a row
Another example inputing "baabugbugbackscarybugbugbug"
would also return 3 as well because bug occurs 3 times in a row
Note: This is not like Occurrences of substring in a string because you're not getting an input of the substring you are looking for and also your not counting the occurences but simply the maximum amount of times it occurs in a row.