Felt like doing a little C programming today. So I attempted today’s ‘Mini challenge’ problem from Reddit’s r/dailyprogrammer. The challenge was to write a program to count the number of occurrences of alphabets contained in a string.
Here’s the problem statement,
Count it – count the letters in a string.
Given: A string – like “Hello World”
Output: Letters and how often they show up. – d:1 e:1 h:1 l:3 o:2 r:1 w:1
Special: convert all to lowercase. Ignore whitespace and anything not [a-z][A-Z]
Challenge input: “The quick brown fox jumps over the lazy dog and the sleeping cat early in the day.”
And here’s my solution,
Do leave your comments & suggestions 🙂
The first time I learnt to write computer code in high school, I was fascinated. It was a C++ program to detect palindromes. I couldn’t get it out of my head all day. I kept thinking about everything else that I could accomplish with C++ code. The more I learnt, the more I practiced and the more I thought, I began to see a profound change in myself. Learning to code had changed the way I saw things, it changed the way I think. Things I saw in day-to-day life, inspired me to code and coding taught me how to think. It was almost enlightening.
Once I graduated high school, I knew exactly what I should do. I joined a computer science engineering program and it goes without saying that those were the best days of my life. I loved everything about computer science. Not only did I learn many more programming languages, I learnt how a programming language is made and much more. But most importantly, I learnt why I loved all this so much. I learned that coding and computers gave me the power to create something right out of my imagination and to see it work right before my eyes. I found what I loved doing – to create, to solve problems and to learn. I found my purpose.
Coding for me is therefore is like yoga or meditation, it enlightens me and it showed me what I would like to call, my purpose. 🙂
I have now graduated college but I haven’t stopped learning, exploring and coding. I never will.