Created
June 13, 2013 06:53
-
-
Save karszawa/5771706 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
AOJ 0501 'Data Conversion' | |
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0501 | |
*/ | |
import std.stdio; | |
import std.array; | |
import std.range; | |
import std.conv; | |
import std.string; | |
import std.algorithm; | |
void main() | |
{ | |
while(true) | |
{ | |
int N = readln().chomp().to!int; | |
if(N == 0) break; | |
int[char] table; | |
foreach(_; 0..N) | |
{ | |
auto line = readln().split().map!("a.to!char"); | |
table[line[0]] = line[1]; | |
} | |
int M = readln().chomp().to!int; | |
string ans; | |
foreach(_; 0..M) | |
{ | |
char c = readln()[0]; | |
ans ~= (c in table ? table[c] : c); | |
} | |
writeln(ans); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment