#C12801. Case-Insensitive String Index Finder

    ID: 42269 Type: Default 1000ms 256MiB

Case-Insensitive String Index Finder

Case-Insensitive String Index Finder

Given a list of strings and a target string, your task is to find the index of the target in the list. The search should be performed in a case-insensitive manner and ignore any leading or trailing whitespace. After normalizing (i.e., trimming and converting all characters to lowercase), if the target is found, return its first occurrence's zero-based index; otherwise, return -1. Note that if the normalized target string is empty, you should also return -1.

inputFormat

The input is given via standard input (stdin). The first line contains an integer n (0 ≤ n ≤ 10^4), representing the number of strings in the list. The following n lines each contain one string from the list. The last line contains the target string to search for.

outputFormat

Output a single line to standard output (stdout) containing the zero-based index of the first occurrence of the target string after normalization. If the target is not found, output -1.## sample

3
  Apple 
banana
Cherry
apple
0

</p>