Motif Detection Inspired by Immune Memory