HELLO_N - Hello person1, person2 and personN

no tags 

Greet multiple people in a "Hello" message. For a given n names, greet by the message "Hello person1, person2, ... and personN".

Input

The input begins with the number t of test cases in single line (t<=10). Each test case in a single line begins with a number n of names of the people followed by n names of the people (n<=10) separated by spaces. A name of a person is alphanumeric single-word of length not exceeding 10 characters.

Output

For every test case print a "Hello" message in a single line such that the message starts with "Hello " and n names of the people separated by a comma and a space except between (n-1)th and nth name where connector "and" is printed, and an exclamation mark at the end of the message. If there are zero or just one name, connector "and" is not necessary. Exclamation mark is printed at end of the message irrespective of number of names.

Example

Input:
5
2 Lisa Sneha
1 Adithya
3 Chandramouli Saimadhav Venkat
0
4 Aarti Debarati Apoorva Anjana Output: Hello Lisa and Sneha!
Hello Adithya!
Hello Chandramouli, Saimadhav and Venkat!
Hello!
Hello Aarti, Debarati, Apoorva and Anjana!

hide comments
nadstratosfer: 2018-09-01 16:23:43

Names contain up to 12 chars.

Francky: 2015-01-13 13:17:57

@psetter : please leave detailed constraints for psolvers. You may possibly give in description :
1) The names of personI are English letters 'a..z' and 'A..Z'.
2) The max length for a name is ... (?)
3) Names are separated by one (or more ?) space.
4(?)option) The maximum number of person is ... (?)
5) The line is feed by '\n' (EOL), before End Of File (EOF).
6) No other char is present in input.

Or you prefer change things.
But it is need to give constraints. Maybe you know well how to solve many problems, but it is recommended to solve an amount to understand how to give correct set of constraints. Thanks for your comprehension.


Added by:Prof. Channa Bankapur
Date:2014-12-26
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C