#K51097. Personalized Greeting Generator
Personalized Greeting Generator
Personalized Greeting Generator
You are given a customer's name and a time of day. Your task is to generate a personalized greeting message in the format Good <Time> <Name>
, where <Time>
is replaced by one of the valid time periods: morning, afternoon, evening, or night.
If the provided time does not match any of the valid time periods, output the exact error message: Invalid time of day. Must be one of 'morning', 'afternoon', 'evening', 'night'
.
The solution should read input from stdin and produce output to stdout.
inputFormat
The input consists of two lines:
- The first line contains the customer's name (a non-empty string).
- The second line contains the time of day as a string. Valid values are:
morning
,afternoon
,evening
, andnight
.
outputFormat
If the provided time is valid, output a single line containing the greeting message in the format Good <Time> <Name>
.
If the time is invalid, output the error message exactly as: Invalid time of day. Must be one of 'morning', 'afternoon', 'evening', 'night'
.
John
morning
Good Morning John