dim q$(6)
dim a$(6)
dim q1$(6)
dim q2$(6)
dim q3$(6)
dim an$(6,3)
dim word$(20)
for x=1 to 6
  read q$(x)
next x
for x=1 to 6
  read q1$(x)
next x
for x=1 to 6
  read q2$(x)
next x
for x=1 to 6
  read q3$(x)
next x
for x=1 to 6
  read a$(x)
next x
for x=0 to 6
  for y=1 to 3
    read an$(x,y)
  next y
next x
quit=0
while quit=0
  input "> ",line$
  if line$<>""
    gosub clear_words
    count=1
    for x=1 to len(line$)
      if mid$(line$,x)=" "
        inc count
      else
        if asc(lower$(mid$(line$,x)))>=97 and asc(lower$(mid$(line$,x)))<=123
          word$(count)=word$(count)+lower$(mid$(line$,x))
        endif
      endif
    next x
 
    found=0
    q=0
    q1=0
    q2=0
    q3=0
    for x=1 to count
      for y=1 to 6
        if found=0 and q$(y)=word$(x)
          found=1
          q=y
        endif
        if q1$(y)=word$(x) then q1=y
        if q2$(y)=word$(x) then q2=y
        if q3$(y)=word$(x) then q3=y
      next y
    next x
    if found=1
      if q=5
        if (q1=1 or q1=4 or q1=5)
          print "I dont' know"
        else
          print "I'm fine"
        endif
      else
        print a$(q)
      endif
    else
      if q2<=3 and q2>0
        print an$(q1,q2)
      else
        if q3>0
          print "hello"
        else
          print "that's nice"
        endif
      endif
    endif
  endif
endwhile
wait key
end
clear_words:
  for x=1 to 20
    word$(x)=""
  next x
return
 
data "who","what","where","why","how","when"
data "do","are","is","did","does","am"
data "i","you","me","","",""
data "hello","hi","greetings","bonjour","hiya","hey"
data "who knows?"
data "no idea"
data "not sure where"
data "I don't know, why not?"
data "how do you?"
data "whenever"
data "I don't","I do not","everything is about you, isn't it?"
data "do you?","I do not","I hardly know you"
data "you must be a grammar teacher","I am not","nice grammar"
data "you is illin'","no it isn't","if you say so"
data "that is in the past now","I did not","lucky you"
data "I'm not so sure what you are saying","pardon?","I'm so sorry"
data "yes, you are","that sounds confusing","huh?"