#C9484. Checking ISBN Presence
Checking ISBN Presence
Checking ISBN Presence
You are given several test cases. For each test case, you are given a list of ISBN strings and a target ISBN string. Your task is to determine whether the target ISBN is present in the list. For each test case, print YES
if the target ISBN exists in the list, otherwise print NO
.
The problem requires you to process input from stdin and output the result to stdout.
In formal terms, for each test case you are provided with an integer \( n \) indicating the number of ISBNs in the list, followed by \( n \) ISBN strings, and then one target ISBN string. If the target is among the list, output YES
; otherwise, output NO
.
Input Format: The first line contains an integer \( t \) denoting the number of test cases. For each test case, there is one line with the following format:
\( n \) ISBN_1 ISBN_2 \(...\) ISBN_n target_ISBN
Output Format: For each test case, output one line containing either YES
or NO
based on whether the target ISBN is present in the list.
inputFormat
The input begins with a single integer \( t \), representing the number of test cases. Each test case is given in a single line:
n ISBN_1 ISBN_2 ... ISBN_n target_ISBN
where \( n \) is the number of ISBNs in the list, followed by \( n \) ISBN strings, and then the target ISBN string.
outputFormat
For each test case, output a single line with either YES
if the target ISBN is found in the list, or NO
otherwise.
3
3 123a abc1 45b6 abc1
2 1a2b 45c6 45c6
1 only only
YES
YES
YES
</p>