We use methods from data mining and knowledge discovery to design an algorithm for detecting motifs in protein sequences. Based on this approach, we have implemented a program called «GYM». The Helix-Turn-Helix Motif was used as a model system on which to test our program. The program was also extended to detect Homeodomain motifs. The detection results for the two motifs compare favorably with existing programs. In addition, the GYM program provides a lot of useful information about a given protein sequence.