#K14291. Repeated Subsequence Detection
Repeated Subsequence Detection
Repeated Subsequence Detection
Given a string s consisting of uppercase English letters, determine whether there exists a repeated subsequence in the string. A repeated subsequence is defined as a sequence that appears at least twice in the string (not necessarily contiguous). The decision is based on the following rules:
- If the length of s is less than or equal to 2, then output
No
. - If any character in s appears more than 2 times, output
Yes
. - Otherwise, if any character appears at least twice (and the string length is greater than 2), output
Yes
. - If no such repetition exists, output
No
.
This problem requires you to check the frequency of characters in the input string and decide based on the above criteria.
Note: Even if a character appears twice in a string of length 2, it is not considered a repeated subsequence.
inputFormat
The input consists of a single line containing a string s composed only of uppercase English letters. The string is read from standard input.
outputFormat
Output a single line containing either Yes
or No
to indicate whether the string contains a repeated subsequence based on the rules given above. The output is written to standard output.
AABEBCDD
Yes