+ 6

Write a program to print the common characters of a string.

8th Jul 2018, 7:55 AM
Crystal!!!😎
Crystal!!!😎 - avatar
16 Answers
+ 6
eg-...if i entered "aparna"...then output should be....aaa
8th Jul 2018, 9:15 AM
Crystal!!!😎
Crystal!!!😎 - avatar
+ 4
i mean common characters
8th Jul 2018, 8:11 AM
Crystal!!!😎
Crystal!!!😎 - avatar
+ 4
more thxn once Ben Allen (Njinx)
8th Jul 2018, 10:50 AM
Crystal!!!😎
Crystal!!!😎 - avatar
+ 4
than*
8th Jul 2018, 10:50 AM
Crystal!!!😎
Crystal!!!😎 - avatar
+ 4
tell me in c or c++ HonFu
8th Jul 2018, 11:00 AM
Crystal!!!😎
Crystal!!!😎 - avatar
+ 4
yes
8th Jul 2018, 6:07 PM
Crystal!!!😎
Crystal!!!😎 - avatar
8th Jul 2018, 6:08 PM
Crystal!!!😎
Crystal!!!😎 - avatar
+ 3
do you mean characters that appear more than once?
8th Jul 2018, 8:00 AM
hinanawi
hinanawi - avatar
+ 3
So you want to count how often a letter occurs in a string? In Python you could do something like: string='Whatever' for x in set(string.lower()): print('Letter {}: {} times'.format( x, string.count(x))) Or if you really just want to print the repeated letters: for x in set(string.lower()): print(x*string.lower().count(x))
8th Jul 2018, 10:16 AM
HonFu
HonFu - avatar
+ 2
Do you want it to output ones that appear more than once, or only the most common characters?
8th Jul 2018, 10:09 AM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 2
I'll try and make something in C++
8th Jul 2018, 11:04 AM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 2
Sorry, Crystal - can't. ;-)
8th Jul 2018, 11:07 AM
HonFu
HonFu - avatar
+ 1
What do you mean by the same characters? Can't you just print the string. A string is just an array of characters
8th Jul 2018, 7:57 AM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 1
Can you be more specific? What do you mean by common characters?
8th Jul 2018, 8:50 AM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 1
do you mean the one that repeats more than one times??
8th Jul 2018, 2:48 PM
Dhanaraj S
Dhanaraj S - avatar