#Occurences of words in a single line of text using hashmaps
1 messages · Page 1 of 1 (latest)
<@&987246399047479336> please have a look, thanks.
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
Here is an example of input and output
Rn i can make hashmaps and probably user input
what's the problem? You can read the input and save it to hashmap where key would be "word" and value would be it's frequency so far
@cobalt ivy
each time you read a new input check if it already exits, if it does then just increase the frequency otherwise initialise it by 1
@cobalt ivy
- Create an empty hashmap and Traverse the text line.
2)while traversing add the new char as a key in the hashmap, if the key already present increment the value by one
3)Now for example if u check 'a' in the hashmap its value will be no of times the 'a' present in the text line.
Ty I figured it out