## The interact function

The interact function takes a function of type String -> String as its argument. The entire input from the standard input device is passed to this function as its argument, and the resulting string is output on the standard output device.

### Predicate on strings

Example: Balanced Brackets

Input:

 1 2 3 4  3 {[()]} {[(])} {{[[(())]]}} 

Output:

 1 2 3  YES NO YES 

The first line contains a single integer n, the number of strings.

Each of the next n lines contains a single string s.

In this example:

• lines split the complete input, as String on the line break, resulting in a [String] (list of strings).
• tail is here just to ignore the first line (normally hackerrank tests have a number denoting the count of following elements)
• yesNo transalte a boolean to a string YES/NO
• unlines joins the resulting list of string, placing a line break between the strings.