You've stated the assignment. What have you tried in order to solve it?
The best way to get at this is to just jump out in it and start trying stuff and see when it fails. Don't be afraid of stuff falling apart in the beginning. That's not what you are going to hand in, anyway. In addition, we don't know if you are expected to use all of the language, or only parts of the language to solve it. If you haven't gotten to, say, maps yet, and we suggest solutions using maps, that isn't going to help you a lot. Another thing is if you are allowed to use library functions, and which you are allowed to use, because some of them trivializes parts of the assignment. We can give far better support to your problem if you try doing part of it yourself, because you will have some concrete questions about the whole thing then. There's some simpler variants of the full assignment you can also try first: 1. Build a system which accepts a string and returns the length of the string. This will set up the necessary scaffold for the later versions of the program. 2. Build a function which traverses through the string, one rune[0] at a time, and then counts every non-space character in the string. 3. Build a function which counts occurrences of characters, but doesn't care about the order in which they are reported. 3.5. Handle capitalization. 4. Build a function which can sort an unordered set of occurrences, or use a library function. This will successively get you closer and closer to the target, by introducing small parts of the whole one thing at a time. [0] One important thing is what the possible input for the strings are. Or said more formally: what's the alphabet looking like? If you only ever expect ASCII characters, the problem is far simpler to solve than if you want to handle full unicode. Especially because you want to care about capitalization---there are languages out there where capitalization isn't as clear cut as one might think. The same goes for "what is a space?". Unicode contains several code points that could be considered spaces. On Sun, Feb 28, 2021 at 4:02 AM Vignesh Kumar <vinesh1...@gmail.com> wrote: > Hello all, > > Thanks in advance. Please help me to finish this assignments. > > Write a program which will accept a string. This program should output all > the characters and number of their occurrences, in order of their > occurrences. So that, character appearing most number of times should be > printed first and characters appearing least number of times (i.e. 1 time) > should appear at the last. Capital and small characters should be > considered as same. Only spaces in the input string should not be counted. > > Example: Input string is "Hello there", it should output: e: 3, h: 2, l: > 2, o:1, i: 1, t : 1, r: 1 * > > > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/b608f1a5-d833-4bf1-b954-61598e30f808n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/b608f1a5-d833-4bf1-b954-61598e30f808n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- J. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAGrdgiWR2DnAT6RbmC00EP1ihXyz0N67DrJbaiH3SU-s0hkkXQ%40mail.gmail.com.