cf/mirror

String Problem

CF
33B1800· expert2s256 MB⌨ stdin/stdout

Examples

Sample 1of 3
Input
uayd
uxxd
3
a x 8
x y 13
d c 3
Output
21
uxyd
Sample 2of 3
Input
a
b
3
a b 2
a b 3
b a 5
Output
2
b
Sample 3of 3
Input
abc
ab
6
a b 4
a b 7
b a 8
c b 11
c a 3
a c 0
Output
-1
33B.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…