+ 1

I want this Output in java :- a3b3abc4 if my input string is :- String input= "aaabbbabcccc in java

String input= "aaabbbabcccc"; https://code.sololearn.com/cXNl9todqL9A/?ref=app

23rd Jun 2023, 6:19 AM
S S
S S - avatar
9 Respostas
+ 3
👍 that's fine.. S S . Start loop from i=0 . //as output missing first letter.. You're welcome...
28th Jun 2023, 5:11 AM
Jayakrishna 🇼🇳
+ 5
You are finding the frequency of each character from string and making a dictionary. But your required output says, it needs same consecutive character count that are more than one. You can simply do by looping through string, if previous and current character is same then increase count else print previous character and count, if more than 1. Then reset count and previous characters. No need of dictionary.. Hope it helps...
23rd Jun 2023, 3:12 PM
Jayakrishna 🇼🇳
+ 4
Had you tried it??
23rd Jun 2023, 8:32 AM
Hasnain [ACTIVE CHALLENGER]
Hasnain [ACTIVE CHALLENGER] - avatar
+ 3
S S , I actually solved the one that got you confused, but in Python. You may want to see this code then compare it with your code in Java. https://code.sololearn.com/cSIcR1f7v7J8/?ref=app It seems a little difficult to "translate" this code into Java..
23rd Jun 2023, 9:16 AM
Dragon RB
Dragon RB - avatar
+ 2
Yes Hasnain [ACTIVE CHALLENGER] but I am not able to find expected results.. find the attached code..
23rd Jun 2023, 8:34 AM
S S
S S - avatar
+ 2
Thank You Jayakrishna 🇼🇳 I will try it..
23rd Jun 2023, 4:17 PM
S S
S S - avatar
+ 2
Thanks for your help..Jayakrishna 🇼🇳 I have tried from your way and successfully executed.. https://code.sololearn.com/cCgCY5M3JFQP/?ref=app
28th Jun 2023, 4:09 AM
S S
S S - avatar
0
S S Jayakrishna is right. You may also check out my code that I gave for example, because his saying is what I used on my code.
23rd Jun 2023, 4:33 PM
Dragon RB
Dragon RB - avatar