#83. 检查相邻特定数字对
检查相邻特定数字对
Adjacent Pair Check
Background
Dawei and Xiaoxiao are playing a number game. They have an array of integers and need to determine if specific adjacent pairs exist in the array.
Problem Description
Given an array of integers, return true if the array contains a next to a or a next to a , but not both.
Input Format
Input is given from standard input in the following format.
A single line containing space-separated integers, representing the array elements.
Output Format
Output to standard output in the following format.
Output
trueif the condition is met; otherwise, outputfalse.
Sample
1 2 2
true
4 4 1
true
4 4 1 2 2
false
Sample Explanation
Sample 1: The array [1, 2, 2] contains adjacent but not adjacent , so it returns true.
Sample 2: The array [4, 4, 1] contains adjacent but not adjacent , so it returns true.
Sample 3: The array [4, 4, 1, 2, 2] contains both adjacent and adjacent , so it returns false.
Constraints
Time limit: 1s, Memory limit: 1024KiB for each test case.