Briefest code to find vowels and print consonants

05AB1E, 62 bytes

Code:

”‡Á•Ë: ÿ”,”Vowelš‹: ”?"aeiou"©vy": "¹y¢««}", "ý,“«¶šÞ: “ª¹®-J,

Explanation:

There is a lot of string compression going on here. Here is a list of all strings that are compressed:

  • ”‡Á•Ë” is equivalent to Enter String.
  • ”Vowelš‹” is equivalent to Vowel Count.
  • “«¶šÞ“ª is equivalent to Remaining characters.

To see how the actual string compression works, see the Hello, World! answer, or an even more elaborate explanation at the bottom of the Code Review question. Without the string compression, the code looks like this:

"Enter String: ÿ","Vowel Count: "?"aeiou"©vy": "¹y¢««}", "ý,"Remaining characters: "¹®-J,

Or a more readable 3-part version:

"Enter String: ÿ",
"Vowel Count: "?"aeiou"©vy": "¹y¢««}", "ý,
"Remaining characters: "¹®-J,

Part 1:

We first push the string "Enter String: ÿ". The ÿ here is used for string interpolation. But since the stack is empty, implicit input is requested. The ÿ will be substituted with the user input. We print this with a newline using ,.

Part 2:

We first print the "Vowel Count: " string without a newline using ?. After that, we push the aeiou string, ©opy that to the register and map over the string using v and do the following:

vy": "¹y¢««}    # Mapping loop

v          }    # The loop itself
 y              # Push the current letter (which is a, e, i, o or u)
  ": "          # Push this string
      ¹         # Push the first input again
       y        # Push the letter again
        ¢       # Count the number of occurences of that letter in the input
         ««     # Concatenate to one single string, (e.g. "a: 4")

This leaves 5 different string onto the stack, the stack looks like this now:

stack: ['a: 0', 'e: 1', 'i: 0', 'o: 2', 'u: 0']

We join each element in the stack with ", " using ý. After this, we print it with a newline using ,.

Part 3:

We first push the string "Remaining characters: ". We push the first input again using ¹. We then push "aeiou" which we retrieve from the register using ®. After this, we remove all letters in aeiou using - and Join this with the Remaining characters-string. Finally, we output this with a newline using ,.

Uses CP-1252 encoding. Try it online!.


JavaScript (ES6), 165

Fixed error in output, thx @Neil
3 bytes saved thx @Dom Hastings

a=prompt`Enter String:`.replace(/[aeiou]/g,v=>(V[v]=-~V[v],''),V=[]);alert("Vowel Count: "+[...'aeiou'].map(v=>v+': '+(V[v]|0)).join`, `+`
Remaining characters: `+a)


Python, 168 bytes

s=input('Enter String:')
v='aeiou'
print('Vowel Count: '+', '.join([a+':'+str(s.count(a)) for a in v])+'\nRemaining characters: '+''.join([a for a in s if a not in v]))

https://repl.it/CMzO/1