#P12005. 【MX-X10-T1】[LSOT-4] 如何用中间忘了写一篇排版整齐的题解?

【MX-X10-T1】[LSOT-4] 如何用中间忘了写一篇排版整齐的题解?

Description

Given a Markdown article of length nn, determine whether it satisfies:

  • Chinese characters are separated from English letters, numbers, or formulas by half-width spaces.
  • Chinese punctuation marks should not have spaces (regardless of quantity) between them and English letters, numbers, or formulas.

In other words:

  • No adjacent Chinese characters and English letters, numbers, or formulas exist.
  • No pair of Chinese punctuation marks and English letters, numbers, or formulas has only spaces (any number) between them.

If the article satisfies the conditions, output Yes. Otherwise, output No.

For simplicity, the article is guaranteed to consist only of the characters a@1$,_, where:

  • a represents English letters.
  • @ represents Chinese characters.
  • 1 represents numbers.
  • $ represents formulas. Note: This differs from the traditional meaning of $.
  • , represents Chinese punctuation.
  • _ represents spaces.

Input Format

One line containing a string of length nn composed solely of a@1$,_, representing the Markdown article.

Output Format

One line containing Yes if the article meets the criteria, or No otherwise.

a@1$,_

No

a,@_1$,_

Yes

,__a

No

Hint

Sample Explanation #1

The only Chinese character is adjacent to an English letter/number, violating the requirements. Hence, the article should be rejected.

Sample Explanation #2

All Chinese characters are properly separated from English letters/numbers/formulas by spaces. All Chinese punctuation marks have no spaces between them and English letters/numbers/formulas. The article meets the criteria.

Sample Explanation #3

The only Chinese punctuation mark and an English letter are separated only by spaces, violating the requirements. Hence, the article should be rejected.

Data Range

  • For 20%20\% of the data: n3n \le 3.
  • For another 20%20\%: no formulas exist.
  • For another 20%20\%: no Chinese characters exist.
  • For all data: 1n1001 \le n \le 100, and the string contains only a@1$,_.

Translation by DeepSeek R1