Code in python for decreasong character count | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Code in python for decreasong character count

Hi friends..I have a string.. for which i have to perform decreasing character count in python..eg:i/p: bacbadbad...o/p: a3b3\nd2\nc1..

9th Feb 2020, 3:01 PM
Selvi. P
14 Answers
9th Feb 2020, 5:05 PM
Oma Falk
Oma Falk - avatar
+ 2
S=str(input()) L=[] For i in s: If i not in L: L.append(i) For i in L: K.append(s.count(i)) K=sorted(K)[::-1] For i in k: For j in i: If i==s.count(j): Print(j+str(i))
9th Feb 2020, 3:35 PM
Selvi. P
9th Feb 2020, 4:13 PM
Oma Falk
Oma Falk - avatar
+ 2
Wow thanks a lot 🤗🤗
9th Feb 2020, 11:46 PM
Selvi. P
+ 1
Ok ...😇
9th Feb 2020, 3:56 PM
Selvi. P
+ 1
g4 f1z1 This should b ur output friend...which i require..
9th Feb 2020, 4:24 PM
Selvi. P
+ 1
Even i m getting g4 f1 z1 in separate lines ...but what i need is that..alphabets with same count should be sorted and printed in same line...
9th Feb 2020, 4:26 PM
Selvi. P
+ 1
Nice code
11th Feb 2020, 6:16 AM
Lukman Farhan Aden
Lukman Farhan Aden - avatar
0
Please show us your attempt :)
9th Feb 2020, 3:29 PM
Denise Roßberg
Denise Roßberg - avatar
0
I didnt get perfect o/p..😥
9th Feb 2020, 3:30 PM
Selvi. P
0
Selvi. P That's not bad. Important is that we are see that you are working on a code and not just asking for it.
9th Feb 2020, 3:33 PM
Denise Roßberg
Denise Roßberg - avatar
0
U can believe me friend🤗
9th Feb 2020, 3:36 PM
Selvi. P
0
How is this related to my question??
9th Feb 2020, 3:41 PM
Selvi. P
0
Selvi. P If you mean why I asked you for a code: you can read the q&a rules here. https://www.sololearn.com/discuss/1316935/?ref=app
9th Feb 2020, 3:44 PM
Denise Roßberg
Denise Roßberg - avatar