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

26558번 - Clothes 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB122786664.078%

문제

Billy’s mom recently washed his clothes. When his mom finishes washing his clothes, she folds them and stacks them in one large pile. It is then Billy’s responsibility to sort the clothes into three drawers for shirts, pants, and socks. When he places these items in the drawers he takes the top one off of the stack his mom gave to him and places it at the top of the stack in the respective drawer.

Each day Billy must wear a shirt, pants, and socks. He simply picks the top one off each stack in each drawer to wear for that day. Given the original stack of washed clothes, determine what Billy will wear up until he needs more clothes washed. Billy needs more clothes when he runs out of any necessary article of clothing for the day. Billy will only wear a piece of clothing once before it is declared dirty and needs washing. He does not ever wear dirty clothes.

입력

The first line of input will contain a single integer n that indicates the number datasets to follow. Each dataset begins with an integer c which is between 1 and 50. The next c lines are the stack of clean clothing in the format “article (type)” where article is the name of the article of clothing and type is the type of clothing. The value of type will be shirt, pants, or socks.

출력

The output will be a series of lines. Each line will contain the three articles of clothing for the specific day separated by a comma and one space. The shirt will be printed first followed by the pants and socks. The type should not be printed. There should be one blank line after each dataset.

제한

예제 입력 1

2
6
mario logo (shirt)
red (pants)
hawaiian (shirt)
baggy (pants)
white (socks)
fancy (socks)
10
khaki (pants)
blueish green (shirt)
apple (shirt)
bright (socks)
blue (pants)
red (pants)
purple (socks)
ugly (shirt)
stupid (socks)
big red (pants)

예제 출력 1

hawaiian, baggy, fancy
mario logo, red, white
ugly, big red, stupid
apple, red, purple
blueish green, blue, bright

힌트

출처

School > PLU High School Programming Contest > PLU 2019 > Novice 1번

School > PLU High School Programming Contest > PLU 2019 > Advanced 1번

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

출처

대학교 대회

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

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