Logo
(追記) (追記ここまで)

6493번 - Slurpys 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB25913411257.436%

문제

Recognizing strings based on a set of restrictions is a common computational problem. A Slurpy is a string of characters that has certain properties. Your program will read in strings of characters and output whether or not they are Slurpys.

A Slump is a character string that has the following properties:

  1. Its first character is either a 'D' or an 'E'.
  2. The first character is followed by a string of one or more 'F's.
  3. The string of one or more 'F's is followed by either a Slump or a 'G'. The Slump or 'G' that follows the F's ends the Slump. For example DFFEFFFG is a Slump since it has a 'D' for its first character, followed by a string of two F's, and ended by the Slump 'EFFFG'.
  4. Nothing else is a Slump.

A Slimp is a character string that has the following properties:

A Slimp is a character string that has the following properties:

  1. Its first character is an 'A'.
  2. If it is a two character Slimp then its second and last character is an 'H'.
  3. If it is not a two character Slimp then it is in one of these two forms:
    • 'A' followed by 'B' followed by a Slimp followed by a 'C'.
    • 'A' followed by a Slump (see above) followed by a 'C'.
  4. Nothing else is a Slimp.

A Slurpy is a character string that consists of a Slimp followed by a Slump.

Examples

  • Slumps: DFG, EFG, DFFFFFG, DFDFDFDFG, DFEFFFFFG
  • Not Slumps: DFEFF, EFAHG, DEFG, DG, EFFFFDG
  • Slimps: AH, ABAHC, ABABAHCC, ADFGC, ADFFFFGC, ABAEFGCC, ADFDFGC
  • Not Slimps: ABC, ABAH, DFGC, ABABAHC, SLIMP, ADGC
  • Slurpys: AHDFG, ADFGCDFFFFFG, ABAEFGCCDFEFFFFFG
  • Not Slurpys: AHDFGA, DFGAH, ABABCC

입력

The first line contains an integer N between 1 and 10 describing how many strings of characters are represented. The next N lines each contain a string of 1 to 60 alpha characters.

출력

Each of the next N lines of output should consist of either YES or NO depending on whether or not the corresponding input line is a Slurpy.

제한

예제 입력 1

2
AHDFG
DFGAH

예제 출력 1

YES
NO

힌트

출처

ICPC > Regionals > North America > Mid-Atlantic Regional > 1996 Mid-Atlantic Regional Programming Contest 8번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /