      SUBROUTINE MAIN
      LOGICAL*1 GETCH, XOR
      LOGICAL*1 C, KEY(512), B
      INTEGER GETARG, MOD
      INTEGER I, KEYLEN
      LOGICAL*1 USESTR(19)
      DATA USESTR(1)/117/,USESTR(2)/115/,USESTR(3)/97/,USESTR(4)/103/,US
     *ESTR(5)/101/,USESTR(6)/58/,USESTR(7)/32/,USESTR(8)/32/,USESTR(9)/9
     *9/,USESTR(10)/114/,USESTR(11)/121/,USESTR(12)/112/,USESTR(13)/116/
     *,USESTR(14)/32/,USESTR(15)/107/,USESTR(16)/101/,USESTR(17)/121/,US
     *ESTR(18)/46/,USESTR(19)/0/
      CALL QUERY(USESTR)
      KEYLEN = GETARG(1,KEY,512)
      IF (.NOT.(KEYLEN .EQ. -1))GOTO 23000
      CALL ERROR(USESTR)
23000 CONTINUE
      I=1
23002 IF (.NOT.(GETCH(C,1) .NE. -1))GOTO 23004
      IF (.NOT.(C .LT. 32))GOTO 23005
      CALL PUTCH(C,2)
      GOTO 23006
23005 CONTINUE
      B = XOR(C, KEY(I) .AND. 31)
      IF (.NOT.(B .EQ. 127))GOTO 23007
      B = C
23007 CONTINUE
      CALL PUTCH(B,2)
23006 CONTINUE
23003 I = MOD(I,KEYLEN) + 1
      GOTO 23002
23004 CONTINUE
      RETURN
      END
      LOGICAL*1 FUNCTION XOR(A,B)
      LOGICAL*1 A, B
      XOR = (A .AND. .NOT.B) .OR. (.NOT.A .AND. B)
      RETURN
      END
