#21. 检查数组中特定元素的数量
检查数组中特定元素的数量
Check Array Elements
Background
This problem involves checking specific conditions within a small integer array.
Problem Description
Given an integer array, return true if the array contains the number 2 exactly twice, or the number 3 exactly twice. The array will have a length of 0, 1, or 2.
Input Format
Input is given from standard input in the following format.
An array of integers, represented as space-separated numbers on a single line.
Output Format
Output is printed to standard output in the following format.
trueorfalse
Sample
2 2
true
3 3
true
2 3
false
Sample Explanation
Sample 1: The array [2, 2] contains the number 2 exactly twice, so the output is true.
Sample 2: The array [3, 3] contains the number 3 exactly twice, so the output is true.
Sample 3: The array [2, 3] contains neither the number 2 twice nor the number 3 twice, so the output is false.
Constraints
Time limit: 1s, Memory limit: 1024KiB for each test case.