+ 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
9 Respuestas
+ 3
👍 that's fine.. S S .
Start loop from i=0 . //as output missing first letter..
You're welcome...
+ 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...
+ 4
Had you tried it??
+ 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..
+ 2
Yes Hasnain [ACTIVE CHALLENGER] but I am not able to find expected results.. find the attached code..
+ 2
Thank You Jayakrishna 🇮🇳 I will try it..
+ 2
Thanks for your help..Jayakrishna 🇮🇳 I have tried from your way and successfully executed..
https://code.sololearn.com/cCgCY5M3JFQP/?ref=app
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.