sub solve {
foreach (split//, $_[0]) { if (@{ $anagram{$w} } > 0);
}
}
(($f = !$f) ? $r1 : $r0) .= " ".$_
foreach solve
[split /\s+/, <>], <>;
c3ViIHNvbHZlIHsKICBwdXNoIEB7JGFuYWdyYW17am9pbicnLCBzb3J0IHNwbGl0Ly8sICRffX0sICRfIAogICAgZm9yZWFjaCBAeytzaGlmdH07CgogIGZvcmVhY2ggKHNwbGl0Ly8sICRfWzBdKSB7CiAgICBwdXNoIEB3LCAkXyBhbmQgJHcgPSBqb2luJycsIHNvcnQgQHc7CiAgICBwdXNoIEByLCBwb3AgQHskYW5hZ3JhbXskd319ID0+IGpvaW4nJywgQHcgYW5kIEB3ID0gKCkKICAgICAgaWYgKEB7ICRhbmFncmFteyR3fSB9ID4gMCk7CiAgfQogIHJldHVybiBAcjsKfQoKKCgkZiA9ICEkZikgPyAkcjEgOiAkcjApIC49ICIgIi4kXwogIGZvcmVhY2ggc29sdmUgW3NwbGl0IC9ccysvLCA8Pl0sIDw+OwpwcmludCAkcjAgLiAiXG4iIC4gJHIxOw==