I'm getting the same wrong output in Perl 5.28.1 which is the version Code Jam uses. I noticed both 5.26.1 and 5.33.7 (the other versions available to me) gave the correct answer, so I tried to bisect it. The bug was introduced in https://github.com/Perl/perl5/commit/2813d4adc971fbaa124b5322d4bccaa73e9df8e2 and fixed in https://github.com/Perl/perl5/commit/1d8aafa0548097ffe407cad078f79b4d56fd7dca which means only 5.28.* had this problem.

Ch.

==============================================================================
On Thu, 15 Apr 2021, Neil Agarwal wrote:
Hi all,

Could someone please explain to me the output of the following Perl code in
Code Jam's test run mode? The system gives "BCD" instead of "ABCD", and I
have not been able to reproduce this behavior anywhere else.

$S1 = "1((((((7(9))))))";
$S2 = "1((((((7(9)))))";

print "A" if $S1 =~ /[89]+/;
print "B" if $S1 =~ /[9]+/;
print "C" if $S2 =~ /[89]+/;
print "D" if $S2 =~ /[9]+/;

FWIW, I was having trouble getting my solution to the "Nesting Depth"
problem from the 2020 Qualification Round accepted, and eventually narrowed
it down to this.

https://codingcompetitions.withgoogle.com/codejam/round/000000000019fd27/0000000000209a9f

Thank you!

Neil

--
-- You received this message because you are subscribed to the Google Groups 
Code Jam group. To post to this group, send email to 
[email protected]. To unsubscribe from this group, send email to 
[email protected]. For more options, visit this group at 
https://groups.google.com/d/forum/google-code?hl=en
---
You received this message because you are subscribed to the Google Groups "Google 
Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/155d7fef-6996-4260-92c4-02c96380cdc4n%40googlegroups.com.


--
-- You received this message because you are subscribed to the Google Groups 
Code Jam group. To post to this group, send email to 
[email protected]. To unsubscribe from this group, send email to 
[email protected]. For more options, visit this group at 
https://groups.google.com/d/forum/google-code?hl=en
--- You received this message because you are subscribed to the Google Groups "Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/alpine.LSU.2.21.2104260824480.3243%40silent.

Reply via email to