/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
System.
out.
println(replace
(reader.
readLine(), reader.
readLine(), reader.
readLine())); }
Matcher matcher = Pattern.compile(from).matcher(source);
matcher.reset();
boolean result = matcher.find();
if (result) {
do {
System.
out.
println(matcher.
group()+" menyaem na "+to
); matcher.appendReplacement(sb, to);
result = matcher.find();
} while (result);
matcher.appendTail(sb);
return sb.toString();
}
return source;
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLnV0aWwucmVnZXguTWF0Y2hlcjsKaW1wb3J0IGphdmEudXRpbC5yZWdleC5QYXR0ZXJuOwoKLyogTmFtZSBvZiB0aGUgY2xhc3MgaGFzIHRvIGJlICJNYWluIiBvbmx5IGlmIHRoZSBjbGFzcyBpcyBwdWJsaWMuICovCmNsYXNzIElkZW9uZQp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQlCdWZmZXJlZFJlYWRlciByZWFkZXIgPSBuZXcgQnVmZmVyZWRSZWFkZXIobmV3IElucHV0U3RyZWFtUmVhZGVyKFN5c3RlbS5pbikpOwoJCVN5c3RlbS5vdXQucHJpbnRsbihyZXBsYWNlKHJlYWRlci5yZWFkTGluZSgpLCByZWFkZXIucmVhZExpbmUoKSwgcmVhZGVyLnJlYWRMaW5lKCkpKTsKCX0KCQoJc3RhdGljIFN0cmluZyByZXBsYWNlKFN0cmluZyBzb3VyY2UsIFN0cmluZyBmcm9tLCBTdHJpbmcgdG8pIHsKICAgICAgICBNYXRjaGVyIG1hd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