Created
January 30, 2013 13:39
-
-
Save touzoku/4673372 to your computer and use it in GitHub Desktop.
Problem solution for "Balanced smileys" at Facebook Hacker Cup 2013 Qualification round. https://www.facebook.com/hackercup/problems.php?pid=403525256396727&round=185564241586420
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
use strict; | |
use warnings; | |
use 5.10.00; | |
my $regexp = qr/ | |
^( | |
(?: | |
[a-z :]|:\(|:\)|\((?1)\) | |
)* | |
)$ | |
/x; | |
<>; | |
my $i; | |
for(<>){ | |
$i++; | |
say /$regexp/?"Case #$i: YES":"Case #$i: NO"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment