Inside the :TEXT: event,

/hadd -mu300 LastMsg $nick $strip($1-)
... puts the last thing someone says into the table for 5 minutes, assuming you don't want to compare against something they said 2 days ago. You can first compare

if ($hget(LastMsg,$nick) == $strip($1-)) echo -a This is a match

The other part is harder to compare. You can use "isin" instead of "==" but it's too easy for false matches. Such as someone saying "no" and then the next sentence contains those 2 letters somewhere inside. You could also check to see if newline isin oldline, if they do the repeats backwards, and could also add an additional check for pairs of messages that are both above a certain minimum. But any spammer who gets kicked for example2 can easily alter their spam to avoid just about any rules you can think of.