1. A semiconductor device that searches an input data string for a predesignated keyword, the semiconductor device comprising: a first content-addressable memory that stores a partial keyword corresponding to a predetermined number of data beginning with the first data of the keyword; a second content-addressable memory that stores the entirety of the keyword; and a control circuit that is coupled to the first content-addressable memory and to the second content-addressable memory, wherein, when a portion matching the partial keyword is detected in the input data string by a search in the first content-addressable memory, the control circuit extracts search data from the input data string in accordance with position information about the detected portion matching the partial keyword, and inputs the extracted search data to the second content-addressable memory.