Programming help with java assignment!
How do I get my program to recognize numbers in a row and print the number that appears the most times consecutively in that row.I also need to print the most amount of times it appears consecutively in the row.
eg 1223336677777889771666
ans=7
most times= 5
help plz Tnx
Re: Programming help with java assignment!
What data type is the number stored in? String or int or long or ?
If not String, convert it to a String and then use one of the String class's methods to look at the digits one at a time in a loop and count them.
Re: Programming help with java assignment!
12221314151617
What should your output be for the above? The number 1 appears the most times but number 2 appears consecutively the most but according to your requirements the output should be
ans=1
most times=1