JDCC '17 Contest 3 J2 - Interview Seating

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 64M

Problem type

Justin walks into an interview, and his interviewer asks him to take a seat at an interesting table.

The table has N​ seats on each side of the table, so people can sit across from one another. Some seats are already occupied by people, and so no one can sit there.

Help Thomas figure out whether it is possible for him and his interviewer to sit across from one another at the table!

Input Specification

The first line contains an integer N (1 \le N \le 100), which is the number of people that can be seated on one side of the table.

The next two lines each contain a string of N characters, representing each side of the table. Each character is either X or O, signifying whether the seat is occupied or free respectively.

Output Specification

Output :) if Thomas and his interviewer can sit across from one another, or :( if they can't.

Sample Input 1

4
XOXO
OXOO

Sample Output 1

:)

Explanation for Sample 1

There is a pair of empty seats facing each other at the very end of the table.

Sample Input 2

4
XXOX
OOXO

Sample Output 2

:(

Explanation for Sample Input 2

No matter how Thomas chooses their seats, they can't sit across from one another.


Comments

There are no comments at the moment.