+ 2

How to get the correct output like

my code output name=boopathi output: ' b '= 1' o '= 2 ' o '= 2' p '= 1' a '= 1 ' t '= 1 ' h '= 1 ' i '= 1 but i need output b=1 o=2 p=1 a=1 t=1 h=1 i=1 https://code.sololearn.com/cFHKG5s5F96V/?ref=app

30th Sep 2018, 1:40 AM
Programmer Raja
Programmer Raja - avatar
11 Respuestas
30th Sep 2018, 3:38 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 6
Create two arrays, one with letters you already found and one with the letter count. Iterate over the letters of the word. If you already found the letter, increase the letter count. If not, add the letter to the array and set the letter count to 1. Eventually you'll have an array of unique letters and the corresponding letter count in the other array
30th Sep 2018, 6:52 AM
Anna
Anna - avatar
+ 2
jares can you say how plse
30th Sep 2018, 2:07 AM
Programmer Raja
Programmer Raja - avatar
+ 2
Anna thanks
30th Sep 2018, 6:55 AM
Programmer Raja
Programmer Raja - avatar
+ 2
Show yours first. It says your code hasn't been changed for seven hours 😏
30th Sep 2018, 10:08 AM
Anna
Anna - avatar
+ 1
supriya i need output not in new line the 'O' occur two times in output i need only one time in output
30th Sep 2018, 1:59 AM
Programmer Raja
Programmer Raja - avatar
+ 1
You need to think about how you can skip duplicate letters​ from repeating. There's more than one way of doing it, but this should be part of the letter counting algorithm.
30th Sep 2018, 2:05 AM
Jared Bird
Jared Bird - avatar
+ 1
Boopathi you get more out of it you can solve it yourself. I can see 3 ways to go about solving this: 1) Maintain a list of letters you have already come across, and only print if not in the list. 2) Delete the duplicate letters​ from the name array as you find them. 3) Search the array before the letter you are looking at, and only print if not present.
30th Sep 2018, 2:16 AM
Jared Bird
Jared Bird - avatar
+ 1
Anna i try but i can't finish that can you help me .can you give source code plse plse
30th Sep 2018, 10:01 AM
Programmer Raja
Programmer Raja - avatar
30th Sep 2018, 10:58 AM
Programmer Raja
Programmer Raja - avatar