1. A document checking apparatus comprising: a memory; and a processor coupled to the memory, wherein the processor executes a process comprising: extracting character strings each of which includes a predetermined word or a predetermined phrase from a target document and a confidential document that becomes a comparison target when determining similarity between documents; first determining, based on appearance positions of the character strings extracted at the extracting, whether another character string is extracted within a predetermined range extending from a target character string toward either front or rear of the documents at the extracting; generating, when it is determined at the first determining that the another character string is extracted within the predetermined range, a feature element matrix having a specific value in a matrix element at a row and a column corresponding to a pair of hash values of the target character string and the another character string within the predetermined range; comparing the feature element matrix of the target document and the feature element matrix of the confidential document generated at the generating; and second determining whether a number of common elements having the specific value commonly among the feature element matrices of the target document and the confidential document is not less than a first similarity determination number to determine similarity between the target document and the confidential document on the basis of the determination result.