+ 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
12 ответов
+ 12
Boopathi here's my try
https://code.sololearn.com/c2BwwNayUWA1/?ref=app
+ 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
+ 2
jares can you say how plse
+ 2
Anna thanks
+ 2
Show yours first. It says your code hasn't been changed for seven hours 😏
+ 1
supriya i need output not in new line
the 'O' occur two times in output i need only one time in output
+ 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.
+ 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.
+ 1
Anna i try but i can't finish that can you help me .can you give source code plse plse
+ 1