#K13441. Consecutive Duplicates Check
Consecutive Duplicates Check
Consecutive Duplicates Check
In this problem, you are given a list of tokens representing elements. Your task is to determine whether the list contains any pair of consecutive duplicate elements. Formally, given a sequence (a_1, a_2, \ldots, a_n), determine if there exists an index (i), with (1 \le i < n), such that (a_i = a_{i+1}).
Note: The input tokens can be numbers, strings, booleans, etc. For the purposes of this problem, you should treat them as strings and check for exact equality. For example, even though in some languages 1 and 1.0 might be considered equal, if they appear as different tokens in the input they will be considered distinct unless they are exactly identical.
Example: For the list 1 2 3 4 4 5
, the answer is True
because the two consecutive 4
s are equal.
inputFormat
The input is given via standard input (stdin). The first line contains a single integer (n) representing the number of tokens in the list. The second line contains (n) tokens separated by spaces.
outputFormat
Output a single line to standard output (stdout): print True
if there exists any pair of consecutive identical tokens; otherwise, print False
.## sample
6
1 2 3 4 4 5
True