r/ProgrammingPrompts • • Jan 14 '15
[Easy] Letter Counter
Any language permitted.
Problem: Create a program where you input a string of characters, and output the number of each letter. Use vowels by default.
For example: asbfiusadfliabdluifalsiudbf -> a: 4 e: 0 i: 4 o: 0 u: 3
Bonus points: Make it command-line executable, with an optional mode to specify which letters to print.
16
Upvotes
View all comments
Show parent comment
1
u/okcodex Jan 14 '15 edited Jan 14 '15
Thanks man. I just ran it a few more times and I'm not happy about a few other things ... for example I should probably .toUpperCase() everything so that it doesn't think "a" and "A" are different... and I should probably ignore spaces... but it's time to move on :PMade the changes anyway because I'm obsessive.