Quite a few changes,I've come undone.
The code now recognises if zero, one or more names are input and will sort them to only output those that contain the letter 'a'