In this paper, we present a new data hiding scheme (1,7,4) for grayscale images, where 7 is the number of pixels in each block of the image, 4 is the number of secret bits which can be hidden in each block with restriction that at most one pixel is changed, and the gray value is changed at most 3 from the original one. As shown in the paper, this reaches the theoretical limit MSDR1 of hidden bits in each 7-block of images. A hiding scheme (2,14,8) is obtained as a direct consequence, and one application of this scheme is given to solve the problem of searching in hidden texts in stego-images. To solve this problem, finite automata technique with fuzzy approach is introduced.