A - OX Game Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 9

注意

この問題に対する言及は、2020/12/27 18:00 JST まで禁止されています。言及がなされた場合、賠償が請求される可能性があります。 試験後に総合得点や認定級を公表するのは構いませんが、どの問題が解けたかなどの情報は発信しないようにお願いします。

問題文

以下のルールで○✕ゲームが行われています。

  1. まず、縦 1 マス、横 5 マスのマス目を作る。
  2. 全てのマスに o または x を書き込む。
  3. o が横に連続して 3 つ以上並んでいるなら、 o の勝ちである。
  4. そうでなくて、 x が横に連続して 3 つ以上並んでいるなら、 x の勝ちである。
  5. このどちらでもない場合、引き分けである。

書き込みが終わった後のマス目の状態が与えられます。左から i 番目のマスに書かれた記号は S_i です。
○✕ゲームの結果を判定してください。

制約

  • S_io または x

入力

入力は以下の形式で標準入力から与えられる。

S_1S_2S_3S_4S_5

出力

o の勝ちならば o を、 x の勝ちならば x を、引き分けならば draw を出力せよ。


入力例 1

xooox

出力例 1

o

o が連続して 3 つ並んでいるので、 o の勝ちです。


入力例 2

xxxxx

出力例 2

x

x が連続して 5 つ並んでいるので、 x の勝ちです。


入力例 3

xoxxo

出力例 3

draw

ox3 つ以上連続して並んでいないため、引き分けです。

Score : 9 points

Warning

Do not make any mention of this problem until December 27, 2020, 6:00 p.m. JST. In case of violation, compensation may be demanded. After the examination, you can reveal your total score and grade to others, but nothing more (for example, which problems you solved).

Problem Statement

Two persons are playing "OX Game" in the following manner:

  1. They draw a horizontal row of five squares.
  2. They write o or x in each square.
  3. If there are three or more consecutive os, the player o wins.
  4. Otherwise, if there are three or more consecutive xs, the player x wins.
  5. If neither of the above holds, the game is drawn.

You are given the state of the row of squares after the persons write symbols; the symbol written in the i-th square from the left is S_i.
Determine the winner of the game.

Constraints

  • S_i is o or x.

Input

Input is given from Standard Input in the following format:

S_1S_2S_3S_4S_5

Output

If the player o wins, print o; if the player x wins, print x; if the game is drawn, print draw.


Sample Input 1

xooox

Sample Output 1

o

We have three consecutive os, so the player o wins.


Sample Input 2

xxxxx

Sample Output 2

x

We have five consecutive xs, so the player x wins.


Sample Input 3

xoxxo

Sample Output 3

draw

We have neither three consecutive os nor three consecutive xs, so the game is drawn.