#abc230b. B - Triple Metre

B - Triple Metre

Score : 200200 points

问题描述

设一串字符串 SS 被称为字符串 TT 的子串,当存在一对整数 iijj(满足 1ijT1 \leq i \leq j \leq |T|),且满足以下条件时。

  • 从第 ii 个到第 jj 个字符不改变顺序地提取出的 TT 中的子序列等于 SS

TToxx 连接而成的重复 10510^5 次的字符串。
给定一个字符串 SS,如果 SSTT 的子串,则输出 Yes,否则输出 No

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

A string SS is said to be a substring of a string TT when there is a pair of integers ii and jj (1ijT)1 \leq i \leq j \leq |T|) that satisfy the following condition.

  • The extraction of the ii-th through jj-th characters of TT without changing the order equals SS.

Let TT be the concatenation of 10510^5 copies of oxx.
Given a string SS, print Yes if SS is a substring of TT, and No otherwise.

Constraints

  • SS is a string consisting of o and x.
  • The length of SS is between 11 and 1010 (inclusive).

Input

Input is given from Standard Input in the following format:

SS

Output

If SS satisfies the condition, print Yes; otherwise, print No.

Sample Input 1

xoxxoxxo

Sample Output 1

Yes

TT begins like this: oxxoxxoxxoxx... Since the extraction of 33-rd through 1010-th characters of TT equals SS, SS is a substring of TT, so Yes should be printed.

Sample Input 2

xxoxxoxo

Sample Output 2

No

Since there is no way to extract from TT a string that equals SS, SS is not a substring of TT, so No should be printed.

Sample Input 3

ox

Sample Output 3

Yes

update @ 2024/3/10 10:02:53