Under construction

Still being built. Things may change

Witness

Time limit1sMemory limit512 MB

Summary
Given a one-dimensional row of Baba Is You blocks and obstacles, decide whether BABA can reach the FLAG and print BABA IS WIN or BABA IS NOT WIN.
Level

Easy2 of 10

Topics
Implementation, Simulation
Solved
No attempts yet

Problem

WITNESS IS BABA!

Writing a real Baba Is You solver would be unfair to the 구데기컵 participants, so assume the following rules are absolute truth:

BABAFLAG
LEVELISLEVELISINFINITE
YOUWIN

Also assume the map always has the form shown below.

The grading data consists only of the examples.

So the input is a row of text blocks and obstacles in order, laid out in one dimension. You may assume there is enough space between obstacles, and each obstacle is one layer thick.

Your job is to decide whether the given level can be won.

Input

The first line contains at most 100 blocks. Blocks are separated by spaces.

The second line gives the type of each obstacle.

Output

If the level can be won, print BABA IS WIN. Otherwise, print BABA IS NOT WIN.

Examples4

  1. Example 1

    Input
    KEY IS PUSH AND OPEN DOOR IS SHUT
    KEY DOOR
    Expected output
    BABA IS WIN
  2. Example 2

    Input
    BABA IS ROCK
    ROCK
    Expected output
    BABA IS NOT WIN
  3. Example 3

    Input
    LONELY FLAG IS BABA
    ROCK
    Expected output
    BABA IS WIN
  4. Example 4

    Input
    TEXT IS NOT PUSH WALL IS STOP
    WALL
    Expected output
    BABA IS NOT WIN