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.

17 Upvotes

60 comments sorted by

View all comments

Show parent comment

3

u/[deleted] Jan 15 '15

In short "Because I can" is the most accurate answer, or better: "Because BASH can". For most simple streamline tasks I don't want to throw on an editor and develop a little something I probably only need once while I can achieve the same thing with a little bash piping. I don't need to leave the editor to test my app, I simply extend the pipe until the data are transformed the way I needed them. The function around the pipe was only for better readability for reruns, it was originally a direct pipe of a string into tr

2

u/[deleted] Jan 15 '15

"Because I can" is always the best reason. Thanks.