! Takoma Park M.S.

! Jr-5

! Contest 4

! Shilpa Kannan

 

DIM stage$(10)

FOR d = 1 to 10

    LET stage$(d) = ""

NEXT d

FOR x = 1 to 5

    INPUT numb,

    FOR y = 1 to numb

        INPUT space,

        LET stage$(space) = "B"

    NEXT y

    INPUT stages

    FOR y = 1 to stages-1

        FOR g = 1 to 10

            LET new = 0

            IF g = 1 then

               IF stage$(1) = "" and stage$(10) = "B" then

                  LET stage$(1) = "B"

                  LET stage$(10) = ""

                  LET new = 1

               END IF

            END IF

            !            IF g <> 10 and stage$(g) = "B" then

            !               LET stage$(g+1) = "B"

            !               LET stage$(g) = ""

            !               LET g = g+2

            !            ELSE IF g=10 and stage$(g) = "B" then

            !               LET stage$(1) = "B"

            !               LET stage$(g) = ""

            !            END IF

            IF g <> 10 and stage$(g+1) = "" and stage$(g) = "B" and new <> 1 then

               LET stage$(g+1) = "B"

               LET stage$(g) = ""

               LET g = g+1

            END IF

!            FOR c = 1 to 10

!                IF stage$(c) = "B" then

!                   PRINT c;",";

!                END IF

!            NEXT c

!print

        NEXT g

    NEXT y

    LET c = 1

    DO until c>10

       IF stage$(c) = "" then

          LET num = 0

       ELSE IF stage$(c) = "B" then

          LET num = num + 1

          IF num>greatest then

             LET greatest = num

          END IF

       END IF

       LET c = c+1

    LOOP

    PRINT greatest

    LET greatest = 0

    LET num = 0

    FOR b = 1 to 10

        LET stage$(b) = ""

    NEXT b

NEXT x

END