Word search P18660


Statement
 

pdf   zip

thehtml

Write a program that solves word searches! Words can be written horizontally (from left to right), vertically (from top to bottom) diagonally (from left to right and from top to bottom).

Input

Input consists in different test data. Each test data contains three parts: the first part contains three natural numbers x, m and n not null. The second part is a sequence of x words. The third part is a matrix with m rows and n columns that represents the word search. Every symbol that appears in the words and in the word search are lowercase letters a,…,z.

Output

For each test data print the matrix of the input, changing the letters which form part of any word to uppercase letters. Separate each letter of the word search by a space; separate each test data by an empty line.

Public test cases
  • Input

    5 6 7
    
    mary george john peter martha
    
    r e m a r y a 
    x y a t r w q
    j e r e s q s
    o o t d a q d 
    h v h f h w x
    n i a n d a z 
    
    5 6 8
    
    frank george john peter martha
    
    r e m a r y a q
    x y a t r w f e
    j e r e s q r i
    o o t d a q a o
    h v h f h w n s
    n i a n d a k m
    

    Output

    r e M A R Y a
    x y A t r w q
    J e R e s q s
    O O T d a q d
    H v H f h w x
    N i A N d a z
    
    r e M a r y a q
    x y A t r w F e
    J e R e s q R i
    O O T d a q A o
    H v H f h w N s
    N i A N d a K m
    
  • Information
    Author
    Jordi Petit
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C C++