You want to buy two neighboring tickets in the first row of the theater so that one of the tickets is as far from the aisles as possible.
You will be given a String describing the first row of the theater where '.' represents an empty seat and 'X' represents an occupied seat. Your task is to return the index (from 0) of the empty seat that is furthest from the aisles (the two ends of the String) and is also next to an empty seat. If there are multiple possible seats, return the one with the smallest index. Return -1 if there are no seats that satisfy your requirements.
int chooseSeat(String row)
(be sure your method is public)
row will contain between 1 and 50 characters, inclusive.
Each character in row will be either '.' or 'X'.
You can buy either tickets with indexes 1 and 2 or tickets with indexes 2 and 3.
You should buy tickets with indexes 3 and 4.
This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved.