Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Google Translate KW Super One day Jojo is typing something while drinking tea and eating snacks. It turns out he is making the very problem

Google Translate KW Super One day Jojo is typing something while drinking tea and eating snacks. It turns out he is making the very problem youre reading right now. One of his biggest pet peeves about making these algorithm problems is that the description has to be written in two languages: English and Indonesian, this means that he has to write the exact same sentences twice in different languages. Because Jojo is a lazy guy, he asks for your help to create a simple translator program so that he only needs to write the problem description in English and let the program translate it to Indonesian.

The translator program works as follows: first the program will be given a dictionary which contains N English words and their translation in Indonesian. The program will then translate an English sentence simply by replacing each word in the sentence with its translation according to the dictionary. If a word doesnt exist in the dictionary, then the program will just display that word again. Now help Jojo to create this translator program!

Format Input The first line contains a single number T, the number of testcases. Each testcase contains a single number N, the number of words in the dictionary. The next N lines contain the word Ai and Bi , where Ai is a English word and Bi is the Indonesian translation of that word. The next line contains Q which is the number of words in the sentence to be translated followed by another line containing all Q words that are in the sentence separated by space.

Format Output For each testcase, output one line starting with Case #X: (without quotes) where X is the testcase number (starting from 1) followed by the translation of the English sentence.

Constraints Lets say that Ci means the i-th word on the English sentence to translate. 1 T 10 1 N, Q 100 1 |Ai |, |Bi |, |Ci | 100 (|S| means the length of S) |Ai |, |Bi |, |Ci | contain only lowercase English letters a-z All values of Ai in a testcase are different

Sample Input (standard input)

2 11 tea teh something sesuatu while sambil one suatu is sedang snacks camilan typing mengetik drinking minum eating makan day hari and dan 12 one day jojo is typing something while drinking tea and eating snacks

9 an seorang am adalah she dia among antara and dan i saya theres ada he dia us kita 10 theres an impostor among us and i am an impostor

Sample Output (standard output)

Case #1: suatu hari jojo sedang mengetik sesuatu sambil minum teh dan makan camilan Case #2: ada seorang impostor antara kita dan saya adalah seorang impostor

Note Use Standard C Language, Input and Output Must Be The Same Please Use Simple Code , With or Without Strtok (Prefer Without Strtok)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions

Question

Explain the multicultural organization development (MCOD) process.

Answered: 1 week ago