#23. 判断数组首元素是否为1
判断数组首元素是否为1
Array First Element Check
Background
Congcong is learning how to process arrays. He encountered a simple problem that requires checking a specific property of given arrays.
Problem Description
Start with two integer arrays, and , of any length. Return how many of the arrays have as their first element.
Input Format
Input is given from standard input in the following format.
Two arrays, with elements of each array separated by spaces. Arrays can be empty.
Output Format
Output is printed to standard output in the following format.
An integer, representing the count of arrays whose first element is .
Sample
[1 2 3] [1 3]
2
[7 2 3] [1]
1
[1 2] []
1
Sample Explanation
Sample 1: The first array [1 2 3] has as its first element, and the second array [1 3] also has as its first element. Thus, there are arrays whose first element is .
Sample 2: The first array [7 2 3] does not have as its first element, but the second array [1] has as its first element. Thus, there is array whose first element is .
Sample 3: The first array [1 2] has as its first element. The second array [] is an empty array and has no first element. Thus, there is array whose first element is .
Constraints
Time limit: second, Memory limit: KiB for each test case.