fork download
  1. <?php
  2. $n = intval(readline());
  3. $regex= '/^([$%])([A-Z][a-z]{2,})\1: \[(\d+)\]\|\[(\d+)\]\|\[(\d+)\]\|$/';
  4. for ($d = 0; $d < $n; $d++) {
  5. $message = readline();
  6. if (preg_match($regex, $message, $matches)) {
  7. $tag = $matches[2];
  8. $decryptedMessage = chr($matches[3]) . chr($matches[4]) . chr($matches[5]);
  9. echo "{$tag}: {$decryptedMessage}\n";
  10. } else {
  11. echo "Valid message not found!\n";
  12. }
  13. }
Success #stdin #stdout 0.03s 26068KB
stdin
Standard input is empty
stdout
Standard output is empty