Further, it is apparent that, for a query for which a shorter array is used, the processing speed is increased the most. [0140] In the above embodiment, the suffix array SA of the text T has been examined to find a desired pattern P. However, a prefix array for the text T may be examined to find the pattern P. The prefix is a character string preceding a specific character that has been designated