Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Post History

66%
+2 −0
Challenges Net​​ or​​ not?

Perl 5, 96 bytes Read stdin. Exits 1 if net, 0 if not. perl -00ae'@l=@r=map{++$c[$-[0]]while/#/g;y/#//||()}@F;@r>@c?@r:@l=@c;exit!grep$r[$_]>@l-2,0,-1' When oriented with longer side ver...

posted 4mo ago by jhnc‭  ·  edited 3mo ago by jhnc‭

Answer
#8: Post edited by user avatar jhnc‭ · 2026-06-07T02:32:23Z (3 months ago)
accessing @- for offset of match start saves 2 bytes; improve comments
  • # [Perl 5], 98 bytes
  • Read stdin. Exits 1 if net, 0 if not.
  • ```bash
  • perl -00ae'@l=@r=map{++$c[(pos)-1]while/#/g;y/#//||()}@F;@r>@c?@r:@l=@c;exit!grep$r[$_]>@l-2,0,-1'
  • ```
  • When oriented with longer side vertical as shown in the challenge:
  • * nets have height 4 or 5
  • * nets never start or end with a "long" column (2+ for height 3; 3+ for height 4; 4+ for height 5) but non-nets always do
  • * for non-nets of height 3 the squares may not be connected when the other orientation is chosen
  • This simplifies to:
  • * non-nets have an start or end column containing more than height-2 squares
  • ```
  • printf "%s\n" '...#..' '####..' '...#..' '......' '......' '......' |
  • # -00 slurps records in paragraph mode
  • # -a loops over records, with lines stored in @F
  • perl -00ae'
  • # compute array of non-zero counts of rows
  • # initialise length direction to horizontal
  • # because "row" counts will be compared to length,
  • # switch either @r or @l to other direction below
  • @l = @r = map {
  • # part-compute array of non-zero counts of columns
  • ++$c[(pos)-1] while /#/g;
  • y/#// || ()
  • } @F;
  • # set length to vertical if appropriate
  • # or use columns for counts
  • @r>@c ? @r : @l
  • = @c;
  • # test if start or end count is out of range
  • # exit with the negation to save a character
  • exit ! grep $r[$_]>@l-2, 0,-1
  • '
  • echo $?
  • ```
  • [Try it online!][TIO-mptr86vk]
  • [Perl 5]: https://www.perl.org/
  • [TIO-mptr86vk]: https://tio.run/##pVldT9tAEHzPr3AzQSQiuYRKfSEC8tQ/AQjRyIVIaRLZQS0C/npTEvLhO@/tzqU8YIzO573d2Z3Z9SIvpt9WyJZ5ucyeHopZXpaN5zLPyucfZXaa/5ksT4eNj5ts/Wf2mi2KyWz5M2uelFnvKjspb2fNblb2b8t@/7HoZu3W/c3g7rr5kpfNi@Zs3uwMs9H4st3J3lej6eWouPz1sHg9O2uNb9qLednpnd/9fppM8z76j8OXj9/9t7d25330fTgqrkbj61FxsX5sPFy//stjkS9axU3r/u5qNO197Q66vfPVCm7908DHz/ryeeekS8Ph89a7bJ6rL3UOh123d/Kuuw2kzWsGQDLAmQaox4L4ZvFYvrOMY@32Qew89V1tD2z@zS31DADowG43h4sYgGrUkbir@ER4LAfGr/ZS5wHEMACHNbqztht4S6FCexMDebuqAYhkU@RYwekEKMiZ4j8fLE1ClvRELLAg4QIiYWqQQlq0ZFuDjKWgTWBABCGI3OJAyCY3kwURSMG0Nam@amnoHd3ILT9aDmx95eHCMAwVgoANVWTByupIJSQylmJDl5qGEYCp0gGaX8FyrLwd4QE9BL4B6bkF21YdWeDTUNwOfBqCwADvLF0@@lnAFXgbAwcDLI7dr7E5NgJtiWNFOo5xLBxZ4GGTq8yGSCBORWxU6yvj122YQGoXWXLX4IIqBpIbEykEQbRcPG9U1VQP7KetjkUWlO5J5i3ocDFLoIwsg7lh1YoItLmSYYIwLPCwbXU8yXt2gLBVDH5UZagyBwYJxKoL0cM4xlkBF8BK7gRohwjXpS6OancAFdq0eKIMsLunWiVkdvVokBH7oTBioa2LfWc3/eIaywPp8wGwJUPLrb0SQWIpViUZbN/LFBcwjJaGln6lE2aPLBrazu63DiLMsqMu21i8aqUrFnxlqUbZhh6gEsYumsqbYw2fqgdS5aNL1oRa3tTqK61ddJL3OZZXGQl@Be8sRhVz40@wIQi5zXZWiiIibIU9yPKaKKhlRc8t6RJOUVLwqtUs8JJMrEAwprr0TNPWWb5wpfoCZ89f4eiEgaMVfKgHaKWJhDrgGGg7tmQwBoSzbyZhiHG9LYdrA4q1K6zvBZs1CWMPMBkLM1XVnlsMiF4AwHyL0@YujAd2r6SLpibbakv5RtrxDOMcbyvfcxMe8PmCZBikjj3oLyaGKjarZfS7oSkfD10crV/VubbEsTHeqrIhN64nOnl55gVN7NtkdFAiqZ0RGOZm5trVT7ccBujPS9qAsLIUdBbsAks4i4a2PKiEXjISo3XMB4vYVDe1aps9anWGgP@YFYcMs9/uyKZfJM7drsRADS6h6Td5uN6c4jg9IO36d75YTuazctUbDB7@AQ "Perl 5 – Try It Online"
  • # [Perl 5], 96 bytes
  • Read stdin. Exits 1 if net, 0 if not.
  • ```bash
  • perl -00ae'@l=@r=map{++$c[$-[0]]while/#/g;y/#//||()}@F;@r>@c?@r:@l=@c;exit!grep$r[$_]>@l-2,0,-1'
  • ```
  • When oriented with longer side vertical as shown in the challenge:
  • * nets have height 4 or 5
  • * nets never start or end with a "long" column (2+ for height 3; 3+ for height 4; 4+ for height 5) but non-nets always do
  • * for non-nets of height 3 the squares may not be connected when the other orientation is chosen
  • This simplifies to:
  • * non-nets have an start or end column containing more than height-2 squares
  • ```
  • printf "%s\n" '...#..' '####..' '...#..' '......' '......' '......' |
  • # -00 slurps records in paragraph mode
  • # -a loops over records, with lines stored in @F
  • perl -00ae'
  • # compute array of non-zero counts of rows
  • # initialise length direction to horizontal
  • # "row" counts will be compared to length, so
  • # switch either @r or @l to other direction below
  • @l = @r = map {
  • # part-compute array of non-zero counts of columns
  • ++$c[ $-[0] ] while /#/g;
  • y/#// || ()
  • } @F;
  • # set length to vertical if appropriate
  • # or use columns for counts
  • @r>@c ? @r : @l
  • = @c;
  • # test if start or end count is out of range
  • # exit with the negation to save a character
  • exit ! grep $r[$_]>@l-2, 0,-1
  • '
  • echo $?
  • ```
  • [Try it online!][TIO-mq35wp24]
  • [Perl 5]: https://www.perl.org/
  • [TIO-mq35wp24]: https://tio.run/##pVldT9tAEHzPr3AzQYBILmmlvhABfuqfAIQgciFSGiI7qEXAX2@ahHz4znu7cykPGKPzeW93dmd2PSvKyfcFsnlRzbOn@3JaVFXrpSqy6uWhyo6LP@P58bC1vMlWf2Zv2awcT@c/s/ZRlfUus6PqZtruZlX/pur3H8tudtK5ux7cXrVfi6p93p4@t0@HWT66ODnNPhb55CIvL37dz97Ozjqj605vufL299N4UvTRfxy@Ln/3399PTj/yH8O8vMxHV3l5vnpoNFy9/MtjWcw65XXn7vYyn/S@dQfd3tfFAm7108LyZ3X5vHPSpeXweetd1s81lzqH/a6bO3nX7QbS5g0DIBngTAPUY0F8s3gs31nGsbb7IHae5q62B9b/5pZ6BgB0YDebw0UMQD3qSNxVfCI8lgPjV3up8wBiGID9Gt1Zmw28pVChvY6BvF3dAESyKXKs4HQCFORM8Z8PliYhS3oiFliQcAGRMA1IIS1asq1BxlLQJjAgghBEbnEgZJObyYIIpGDamlRftTT0jm7klh8tB7a@8nBhGIYKQcCGKrJgZXWkEhIZS7GhS03DCMBU6QDNr2A5Vt6O8IAeAt@A9NyCbauOLPBpKG4HPg1BYIB3li4f/SzgCryNgb0BFsfu1tgcG4G2xLEiHcc4Fo4s8LDJVWZDJBCnIjbq9ZXx6yZMILWLLLkbcEEdA8mNiRSCIFounjeqamoG9tNWxyILSvck8xZ0uJglUEaWwdywakUE2lzJMEEYFnjYtjqe5D07QNgqBj@qMlSZA4MEYtWF6GEc46yAC2AldwK0Q4TrUhcHtTuACm1aPFEG2N1ToxIyu3o0yIj9UBix0NbFvrObfnGN5YH0@QDYkqHl1k6JILEUq5IMtu9ligsYRktDS7/SCbNDFg1tZ/dbexFm2dGUbSxetdIVC76yVKNsQw9QCWMXTeXNsYZP1QOp8tEla0Itbxr1ldYuOsn7HMurjAS/gncWo4q58SfYEITcZjsrRRERtsIeZHlNFNSyoueWdAmnKCl41WoWeEkmViAYU116pmnrLF@4Un2Bs@evcHTCwNEKPtQDtNJEQh1wDLQdWzIYA8LZN5MwxLjelsONAcXKFdb3gvWahLEHmIyFmapqzy0GRC8AYL7FaXMXxgPbV9JFU5NtjaV8I@14hnGOt5XvuQkP@HxBMgxSxx70FxNDFZvVMvrd0JSP@y6O1q/qXFvi2Bhv1dmQG9cTnbw884Im9m0y2iuR1M4IDHMzc@36p1sOA/TnJW1AWFsKOgu2gSWcRUNbHlRCLxmJ0Trkg0Vsqptatc0etT5DwH/MikOG2W13YNMvEud2V2KgBpfQ9Js83GxOcZgekHb9@zybj5@n1aI3GNz/Aw "Perl 5 – Try It Online"
#7: Post edited by user avatar jhnc‭ · 2026-05-31T13:03:25Z (4 months ago)
improve comments
  • # [Perl 5], 98 bytes
  • Read stdin. Exits 1 if net, 0 if not.
  • ```bash
  • perl -00ae'@l=@r=map{++$c[(pos)-1]while/#/g;y/#//||()}@F;@r>@c?@r:@l=@c;exit!grep$r[$_]>@l-2,0,-1'
  • ```
  • When oriented with longer side vertical as shown in the challenge:
  • * nets have height 4 or 5
  • * nets never start or end with a "long" column (2+ for height 3; 3+ for height 4; 4+ for height 5) but non-nets always do
  • * for non-nets of height 3 the squares may not be connected when the other orientation is chosen
  • This simplifies to:
  • * non-nets have an start or end column containing more than height-2 squares
  • ```
  • printf "%s\n" '...#..' '####..' '...#..' '......' '......' '......' |
  • # -00 slurps records in paragraph mode
  • # -a loops over records, with lines stored in @F
  • perl -00ae'
  • # compute array of non-zero counts of rows
  • # default length direction to vertical
  • @l = @r = map {
  • # part-compute array of non-zero counts of columns
  • ++$c[(pos)-1] while /#/g;
  • y/#// || ()
  • } @F;
  • # set length to longer direction if appropriate
  • # use the other direction for counts
  • @r>@c ? @r : @l
  • = @c;
  • # test if start or end count is out of range
  • # exit with the negation to save a character
  • exit ! grep $r[$_]>@l-2, 0,-1
  • '
  • echo $?
  • ```
  • [Try it online!][TIO-mptr86vk]
  • [Perl 5]: https://www.perl.org/
  • [TIO-mptr86vk]: https://tio.run/##pVldT9tAEHzPr3AzQSQiuYRKfSEC8tQ/AQjRyIVIaRLZQS0C/npTEvLhO@/tzqU8YIzO573d2Z3Z9SIvpt9WyJZ5ucyeHopZXpaN5zLPyucfZXaa/5ksT4eNj5ts/Wf2mi2KyWz5M2uelFnvKjspb2fNblb2b8t@/7HoZu3W/c3g7rr5kpfNi@Zs3uwMs9H4st3J3lej6eWouPz1sHg9O2uNb9qLednpnd/9fppM8z76j8OXj9/9t7d25330fTgqrkbj61FxsX5sPFy//stjkS9axU3r/u5qNO197Q66vfPVCm7908DHz/ryeeekS8Ph89a7bJ6rL3UOh123d/Kuuw2kzWsGQDLAmQaox4L4ZvFYvrOMY@32Qew89V1tD2z@zS31DADowG43h4sYgGrUkbir@ER4LAfGr/ZS5wHEMACHNbqztht4S6FCexMDebuqAYhkU@RYwekEKMiZ4j8fLE1ClvRELLAg4QIiYWqQQlq0ZFuDjKWgTWBABCGI3OJAyCY3kwURSMG0Nam@amnoHd3ILT9aDmx95eHCMAwVgoANVWTByupIJSQylmJDl5qGEYCp0gGaX8FyrLwd4QE9BL4B6bkF21YdWeDTUNwOfBqCwADvLF0@@lnAFXgbAwcDLI7dr7E5NgJtiWNFOo5xLBxZ4GGTq8yGSCBORWxU6yvj122YQGoXWXLX4IIqBpIbEykEQbRcPG9U1VQP7KetjkUWlO5J5i3ocDFLoIwsg7lh1YoItLmSYYIwLPCwbXU8yXt2gLBVDH5UZagyBwYJxKoL0cM4xlkBF8BK7gRohwjXpS6OancAFdq0eKIMsLunWiVkdvVokBH7oTBioa2LfWc3/eIaywPp8wGwJUPLrb0SQWIpViUZbN/LFBcwjJaGln6lE2aPLBrazu63DiLMsqMu21i8aqUrFnxlqUbZhh6gEsYumsqbYw2fqgdS5aNL1oRa3tTqK61ddJL3OZZXGQl@Be8sRhVz40@wIQi5zXZWiiIibIU9yPKaKKhlRc8t6RJOUVLwqtUs8JJMrEAwprr0TNPWWb5wpfoCZ89f4eiEgaMVfKgHaKWJhDrgGGg7tmQwBoSzbyZhiHG9LYdrA4q1K6zvBZs1CWMPMBkLM1XVnlsMiF4AwHyL0@YujAd2r6SLpibbakv5RtrxDOMcbyvfcxMe8PmCZBikjj3oLyaGKjarZfS7oSkfD10crV/VubbEsTHeqrIhN64nOnl55gVN7NtkdFAiqZ0RGOZm5trVT7ccBujPS9qAsLIUdBbsAks4i4a2PKiEXjISo3XMB4vYVDe1aps9anWGgP@YFYcMs9/uyKZfJM7drsRADS6h6Td5uN6c4jg9IO36d75YTuazctUbDB7@AQ "Perl 5 – Try It Online"
  • # [Perl 5], 98 bytes
  • Read stdin. Exits 1 if net, 0 if not.
  • ```bash
  • perl -00ae'@l=@r=map{++$c[(pos)-1]while/#/g;y/#//||()}@F;@r>@c?@r:@l=@c;exit!grep$r[$_]>@l-2,0,-1'
  • ```
  • When oriented with longer side vertical as shown in the challenge:
  • * nets have height 4 or 5
  • * nets never start or end with a "long" column (2+ for height 3; 3+ for height 4; 4+ for height 5) but non-nets always do
  • * for non-nets of height 3 the squares may not be connected when the other orientation is chosen
  • This simplifies to:
  • * non-nets have an start or end column containing more than height-2 squares
  • ```
  • printf "%s\n" '...#..' '####..' '...#..' '......' '......' '......' |
  • # -00 slurps records in paragraph mode
  • # -a loops over records, with lines stored in @F
  • perl -00ae'
  • # compute array of non-zero counts of rows
  • # initialise length direction to horizontal
  • # because "row" counts will be compared to length,
  • # switch either @r or @l to other direction below
  • @l = @r = map {
  • # part-compute array of non-zero counts of columns
  • ++$c[(pos)-1] while /#/g;
  • y/#// || ()
  • } @F;
  • # set length to vertical if appropriate
  • # or use columns for counts
  • @r>@c ? @r : @l
  • = @c;
  • # test if start or end count is out of range
  • # exit with the negation to save a character
  • exit ! grep $r[$_]>@l-2, 0,-1
  • '
  • echo $?
  • ```
  • [Try it online!][TIO-mptr86vk]
  • [Perl 5]: https://www.perl.org/
  • [TIO-mptr86vk]: https://tio.run/##pVldT9tAEHzPr3AzQSQiuYRKfSEC8tQ/AQjRyIVIaRLZQS0C/npTEvLhO@/tzqU8YIzO573d2Z3Z9SIvpt9WyJZ5ucyeHopZXpaN5zLPyucfZXaa/5ksT4eNj5ts/Wf2mi2KyWz5M2uelFnvKjspb2fNblb2b8t@/7HoZu3W/c3g7rr5kpfNi@Zs3uwMs9H4st3J3lej6eWouPz1sHg9O2uNb9qLednpnd/9fppM8z76j8OXj9/9t7d25330fTgqrkbj61FxsX5sPFy//stjkS9axU3r/u5qNO197Q66vfPVCm7908DHz/ryeeekS8Ph89a7bJ6rL3UOh123d/Kuuw2kzWsGQDLAmQaox4L4ZvFYvrOMY@32Qew89V1tD2z@zS31DADowG43h4sYgGrUkbir@ER4LAfGr/ZS5wHEMACHNbqztht4S6FCexMDebuqAYhkU@RYwekEKMiZ4j8fLE1ClvRELLAg4QIiYWqQQlq0ZFuDjKWgTWBABCGI3OJAyCY3kwURSMG0Nam@amnoHd3ILT9aDmx95eHCMAwVgoANVWTByupIJSQylmJDl5qGEYCp0gGaX8FyrLwd4QE9BL4B6bkF21YdWeDTUNwOfBqCwADvLF0@@lnAFXgbAwcDLI7dr7E5NgJtiWNFOo5xLBxZ4GGTq8yGSCBORWxU6yvj122YQGoXWXLX4IIqBpIbEykEQbRcPG9U1VQP7KetjkUWlO5J5i3ocDFLoIwsg7lh1YoItLmSYYIwLPCwbXU8yXt2gLBVDH5UZagyBwYJxKoL0cM4xlkBF8BK7gRohwjXpS6OancAFdq0eKIMsLunWiVkdvVokBH7oTBioa2LfWc3/eIaywPp8wGwJUPLrb0SQWIpViUZbN/LFBcwjJaGln6lE2aPLBrazu63DiLMsqMu21i8aqUrFnxlqUbZhh6gEsYumsqbYw2fqgdS5aNL1oRa3tTqK61ddJL3OZZXGQl@Be8sRhVz40@wIQi5zXZWiiIibIU9yPKaKKhlRc8t6RJOUVLwqtUs8JJMrEAwprr0TNPWWb5wpfoCZ89f4eiEgaMVfKgHaKWJhDrgGGg7tmQwBoSzbyZhiHG9LYdrA4q1K6zvBZs1CWMPMBkLM1XVnlsMiF4AwHyL0@YujAd2r6SLpibbakv5RtrxDOMcbyvfcxMe8PmCZBikjj3oLyaGKjarZfS7oSkfD10crV/VubbEsTHeqrIhN64nOnl55gVN7NtkdFAiqZ0RGOZm5trVT7ccBujPS9qAsLIUdBbsAks4i4a2PKiEXjISo3XMB4vYVDe1aps9anWGgP@YFYcMs9/uyKZfJM7drsRADS6h6Td5uN6c4jg9IO36d75YTuazctUbDB7@AQ "Perl 5 – Try It Online"
#6: Post edited by user avatar jhnc‭ · 2026-05-31T12:49:12Z (4 months ago)
fixes typos in explanatory version
  • # [Perl 5], 98 bytes
  • Read stdin. Exits 1 if net, 0 if not.
  • ```bash
  • perl -00ae'@l=@r=map{++$c[(pos)-1]while/#/g;y/#//||()}@F;@r>@c?@r:@l=@c;exit!grep$r[$_]>@l-2,0,-1'
  • ```
  • When oriented with longer side vertical as shown in the challenge:
  • * nets have height 4 or 5
  • * nets never start or end with a "long" column (2+ for height 3; 3+ for height 4; 4+ for height 5) but non-nets always do
  • * for non-nets of height 3 the squares may not be connected when the other orientation is chosen
  • This simplifies to:
  • * non-nets have an start or end column containing more than height-2 squares
  • ```
  • printf "%s\n" '...#..' '####..' '...#..' '......' '......' '......' |
  • # -00 slurps records in paragraph mode
  • # -a loops over records, with lines stored in @F
  • perl -00ae'
  • # compute array of non-zero counts of rows
  • # default length direction to vertical
  • @l = @r = map {
  • # part-compute array of non-zero counts of columns
  • ++$c[(pos)-1] while /#/g;
  • y/#// || ()
  • } @F;
  • # set length to longer direction if appropriate
  • # use the other direction for counts
  • @r>@c ? @r : @l
  • = @c;
  • # test if start or end count is out of range
  • # exit with the negation to save a character
  • exit ! grep $c[$_]>$l-2, 0,-1
  • '
  • echo $?
  • ```
  • [Try it online!][TIO-mptr86vk]
  • [Perl 5]: https://www.perl.org/
  • [TIO-mptr86vk]: https://tio.run/##pVldT9tAEHzPr3AzQSQiuYRKfSEC8tQ/AQjRyIVIaRLZQS0C/npTEvLhO@/tzqU8YIzO573d2Z3Z9SIvpt9WyJZ5ucyeHopZXpaN5zLPyucfZXaa/5ksT4eNj5ts/Wf2mi2KyWz5M2uelFnvKjspb2fNblb2b8t@/7HoZu3W/c3g7rr5kpfNi@Zs3uwMs9H4st3J3lej6eWouPz1sHg9O2uNb9qLednpnd/9fppM8z76j8OXj9/9t7d25330fTgqrkbj61FxsX5sPFy//stjkS9axU3r/u5qNO197Q66vfPVCm7908DHz/ryeeekS8Ph89a7bJ6rL3UOh123d/Kuuw2kzWsGQDLAmQaox4L4ZvFYvrOMY@32Qew89V1tD2z@zS31DADowG43h4sYgGrUkbir@ER4LAfGr/ZS5wHEMACHNbqztht4S6FCexMDebuqAYhkU@RYwekEKMiZ4j8fLE1ClvRELLAg4QIiYWqQQlq0ZFuDjKWgTWBABCGI3OJAyCY3kwURSMG0Nam@amnoHd3ILT9aDmx95eHCMAwVgoANVWTByupIJSQylmJDl5qGEYCp0gGaX8FyrLwd4QE9BL4B6bkF21YdWeDTUNwOfBqCwADvLF0@@lnAFXgbAwcDLI7dr7E5NgJtiWNFOo5xLBxZ4GGTq8yGSCBORWxU6yvj122YQGoXWXLX4IIqBpIbEykEQbRcPG9U1VQP7KetjkUWlO5J5i3ocDFLoIwsg7lh1YoItLmSYYIwLPCwbXU8yXt2gLBVDH5UZagyBwYJxKoL0cM4xlkBF8BK7gRohwjXpS6OancAFdq0eKIMsLunWiVkdvVokBH7oTBioa2LfWc3/eIaywPp8wGwJUPLrb0SQWIpViUZbN/LFBcwjJaGln6lE2aPLBrazu63DiLMsqMu21i8aqUrFnxlqUbZhh6gEsYumsqbYw2fqgdS5aNL1oRa3tTqK61ddJL3OZZXGQl@Be8sRhVz40@wIQi5zXZWiiIibIU9yPKaKKhlRc8t6RJOUVLwqtUs8JJMrEAwprr0TNPWWb5wpfoCZ89f4eiEgaMVfKgHaKWJhDrgGGg7tmQwBoSzbyZhiHG9LYdrA4q1K6zvBZs1CWMPMBkLM1XVnlsMiF4AwHyL0@YujAd2r6SLpibbakv5RtrxDOMcbyvfcxMe8PmCZBikjj3oLyaGKjarZfS7oSkfD10crV/VubbEsTHeqrIhN64nOnl55gVN7NtkdFAiqZ0RGOZm5trVT7ccBujPS9qAsLIUdBbsAks4i4a2PKiEXjISo3XMB4vYVDe1aps9anWGgP@YFYcMs9/uyKZfJM7drsRADS6h6Td5uN6c4jg9IO36d75YTuazctUbDB7@AQ "Perl 5 – Try It Online"
  • # [Perl 5], 98 bytes
  • Read stdin. Exits 1 if net, 0 if not.
  • ```bash
  • perl -00ae'@l=@r=map{++$c[(pos)-1]while/#/g;y/#//||()}@F;@r>@c?@r:@l=@c;exit!grep$r[$_]>@l-2,0,-1'
  • ```
  • When oriented with longer side vertical as shown in the challenge:
  • * nets have height 4 or 5
  • * nets never start or end with a "long" column (2+ for height 3; 3+ for height 4; 4+ for height 5) but non-nets always do
  • * for non-nets of height 3 the squares may not be connected when the other orientation is chosen
  • This simplifies to:
  • * non-nets have an start or end column containing more than height-2 squares
  • ```
  • printf "%s\n" '...#..' '####..' '...#..' '......' '......' '......' |
  • # -00 slurps records in paragraph mode
  • # -a loops over records, with lines stored in @F
  • perl -00ae'
  • # compute array of non-zero counts of rows
  • # default length direction to vertical
  • @l = @r = map {
  • # part-compute array of non-zero counts of columns
  • ++$c[(pos)-1] while /#/g;
  • y/#// || ()
  • } @F;
  • # set length to longer direction if appropriate
  • # use the other direction for counts
  • @r>@c ? @r : @l
  • = @c;
  • # test if start or end count is out of range
  • # exit with the negation to save a character
  • exit ! grep $r[$_]>@l-2, 0,-1
  • '
  • echo $?
  • ```
  • [Try it online!][TIO-mptr86vk]
  • [Perl 5]: https://www.perl.org/
  • [TIO-mptr86vk]: https://tio.run/##pVldT9tAEHzPr3AzQSQiuYRKfSEC8tQ/AQjRyIVIaRLZQS0C/npTEvLhO@/tzqU8YIzO573d2Z3Z9SIvpt9WyJZ5ucyeHopZXpaN5zLPyucfZXaa/5ksT4eNj5ts/Wf2mi2KyWz5M2uelFnvKjspb2fNblb2b8t@/7HoZu3W/c3g7rr5kpfNi@Zs3uwMs9H4st3J3lej6eWouPz1sHg9O2uNb9qLednpnd/9fppM8z76j8OXj9/9t7d25330fTgqrkbj61FxsX5sPFy//stjkS9axU3r/u5qNO197Q66vfPVCm7908DHz/ryeeekS8Ph89a7bJ6rL3UOh123d/Kuuw2kzWsGQDLAmQaox4L4ZvFYvrOMY@32Qew89V1tD2z@zS31DADowG43h4sYgGrUkbir@ER4LAfGr/ZS5wHEMACHNbqztht4S6FCexMDebuqAYhkU@RYwekEKMiZ4j8fLE1ClvRELLAg4QIiYWqQQlq0ZFuDjKWgTWBABCGI3OJAyCY3kwURSMG0Nam@amnoHd3ILT9aDmx95eHCMAwVgoANVWTByupIJSQylmJDl5qGEYCp0gGaX8FyrLwd4QE9BL4B6bkF21YdWeDTUNwOfBqCwADvLF0@@lnAFXgbAwcDLI7dr7E5NgJtiWNFOo5xLBxZ4GGTq8yGSCBORWxU6yvj122YQGoXWXLX4IIqBpIbEykEQbRcPG9U1VQP7KetjkUWlO5J5i3ocDFLoIwsg7lh1YoItLmSYYIwLPCwbXU8yXt2gLBVDH5UZagyBwYJxKoL0cM4xlkBF8BK7gRohwjXpS6OancAFdq0eKIMsLunWiVkdvVokBH7oTBioa2LfWc3/eIaywPp8wGwJUPLrb0SQWIpViUZbN/LFBcwjJaGln6lE2aPLBrazu63DiLMsqMu21i8aqUrFnxlqUbZhh6gEsYumsqbYw2fqgdS5aNL1oRa3tTqK61ddJL3OZZXGQl@Be8sRhVz40@wIQi5zXZWiiIibIU9yPKaKKhlRc8t6RJOUVLwqtUs8JJMrEAwprr0TNPWWb5wpfoCZ89f4eiEgaMVfKgHaKWJhDrgGGg7tmQwBoSzbyZhiHG9LYdrA4q1K6zvBZs1CWMPMBkLM1XVnlsMiF4AwHyL0@YujAd2r6SLpibbakv5RtrxDOMcbyvfcxMe8PmCZBikjj3oLyaGKjarZfS7oSkfD10crV/VubbEsTHeqrIhN64nOnl55gVN7NtkdFAiqZ0RGOZm5trVT7ccBujPS9qAsLIUdBbsAks4i4a2PKiEXjISo3XMB4vYVDe1aps9anWGgP@YFYcMs9/uyKZfJM7drsRADS6h6Td5uN6c4jg9IO36d75YTuazctUbDB7@AQ "Perl 5 – Try It Online"
#5: Post edited by user avatar jhnc‭ · 2026-05-31T12:37:07Z (4 months ago)
rename variables to improve clarity; using array (@l) instead of scalar ($m) allows more efficient ternary
  • # [Perl 5], 109 bytes
  • Read stdin. Exits 1 if net, 0 if not.
  • ```bash
  • perl -00ae'@a=map{++$b[(pos)-1]while/#/g;y/#//||()}@F;$m=@a>@b?@a:@b;@a=@b
  • if@a>@b;exit!grep$a[$_]>$m-2,0,-1'
  • ```
  • When oriented with longer side vertical as shown in the challenge:
  • * nets have height 4 or 5
  • * nets never start or end with a "long" column (2+ for height 3; 3+ for height 4; 4+ for height 5) but non-nets always do
  • * for non-nets of height 3 the squares may not be connected when the other orientation is chosen
  • This simplifies to:
  • * non-nets have an start or end column containing more than height-2 squares
  • ```
  • printf "%s\n" '...#..' '####..' '...#..' '......' '......' '......' |
  • # -00 slurps records in paragraph mode
  • # -a loops over records, with lines stored in @F
  • perl -00ae'
  • # compute array of non-zero counts in rows
  • @a = map {
  • # compute part of array of non-zero counts in columns
  • ++$b[(pos)-1] while /#/g;
  • y/#// || ()
  • } @F;
  • # get length of longer direction
  • $m = @a>@b ? @a : @b;
  • # use other direction for counts
  • @a = @b if @a>@b;
  • # test if start or end count is out of range
  • # exit with the negation to save a character
  • exit ! grep $a[$_]>$m-2, 0,-1
  • '
  • echo $?
  • ```
  • [Try it online!][T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XPLekSTlFS8KrVLPCSTKxAMKa69EzT1lm@cKX6AmfPX@HohIGjFXyoB2iliYQ64BhoO7ZkMAaEs28mYYhxvS2HawOKjSus9wXbNQljDzAZCzNV1Z5bDIheAMC8i9PmLowH9j9JF01NttWW8o204xnGOd5WvucmPODzBckwSB170G9MDFVsVsvoe0NTPh66OFq/qnNtiWNjvFVlQ25cT3Ty8swLmti3yeigRFI7IzDMzcy1q69uOQzQr5e0AWFlKegs2AeWcBYNbXlQCb1kJEbrmBcWsaluatU2e9TqDAH/MSsOGeZruyObfpE497sSAzW4hKbf5OF6c4rj9IC069/ZfDmZTctVbzAY/QM "Perl 5 – Try It Online"
  • # [Perl 5], 98 bytes
  • Read stdin. Exits 1 if net, 0 if not.
  • ```bash
  • perl -00ae'@l=@r=map{++$c[(pos)-1]while/#/g;y/#//||()}@F;@r>@c?@r:@l=@c;exit!grep$r[$_]>@l-2,0,-1'
  • ```
  • When oriented with longer side vertical as shown in the challenge:
  • * nets have height 4 or 5
  • * nets never start or end with a "long" column (2+ for height 3; 3+ for height 4; 4+ for height 5) but non-nets always do
  • * for non-nets of height 3 the squares may not be connected when the other orientation is chosen
  • This simplifies to:
  • * non-nets have an start or end column containing more than height-2 squares
  • ```
  • printf "%s\n" '...#..' '####..' '...#..' '......' '......' '......' |
  • # -00 slurps records in paragraph mode
  • # -a loops over records, with lines stored in @F
  • perl -00ae'
  • # compute array of non-zero counts of rows
  • # default length direction to vertical
  • @l = @r = map {
  • # part-compute array of non-zero counts of columns
  • ++$c[(pos)-1] while /#/g;
  • y/#// || ()
  • } @F;
  • # set length to longer direction if appropriate
  • # use the other direction for counts
  • @r>@c ? @r : @l
  • = @c;
  • # test if start or end count is out of range
  • # exit with the negation to save a character
  • exit ! grep $c[$_]>$l-2, 0,-1
  • '
  • echo $?
  • ```
  • [Try it online!][TIO-mptr86vk]
  • [Perl 5]: https://www.perl.org/
  • [TIO-mptr86vk]: https://tio.run/##pVldT9tAEHzPr3AzQSQiuYRKfSE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BZs1CWMPMBkLM1XVnlsMiF4AwHyL0@YujAd2r6SLpibbakv5RtrxDOMcbyvfcxMe8PmCZBikjj3oLyaGKjarZfS7oSkfD10crV/VubbEsTHeqrIhN64nOnl55gVN7NtkdFAiqZ0RGOZm5trVT7ccBujPS9qAsLIUdBbsAks4i4a2PKiEXjISo3XMB4vYVDe1aps9anWGgP@YFYcMs9/uyKZfJM7drsRADS6h6Td5uN6c4jg9IO36d75YTuazctUbDB7@AQ "Perl 5 – Try It Online"
#4: Post edited by user avatar jhnc‭ · 2026-05-31T05:50:41Z (4 months ago)
we can get position without using explicit counter
  • # [Perl 5], 118 bytes
  • Read stdin. Exits 1 if net, 0 if not.
  • ```bash
  • perl -00ae'@a=map{for$i(0..5){/^.{$i}#/&&$b[$i]++}y/#//||()}@F;$m=@a>@b?@a:@b;@a=@b
  • if@a>@b;exit!grep$a[$_]>$m-2,0,-1'
  • ```
  • When oriented with longer side vertical as shown in the challenge:
  • * nets have height 4 or 5
  • * nets never start or end with a "long" column (2+ for height 3; 3+ for height 4; 4+ for height 5) but non-nets always do
  • * for non-nets of height 3 the squares may not be connected when the other orientation is chosen
  • This simplifies to:
  • * non-nets have an start or end column containing more than height-2 squares
  • ```
  • printf "%s\n" '...#..' '####..' '...#..' '......' '......' '......' |
  • # -00 slurps records in paragraph mode
  • # -a loops over records, with lines stored in @F
  • perl -00ae'
  • # array of non-zero counts in rows
  • @a = map {
  • # array of non-zero counts in columns
  • for $i (0..5) {
  • /^.{$i}#/ && $b[$i]++
  • }
  • y/#// || ()
  • } @F;
  • # get length of longer direction
  • $m = @a>@b ? @a : @b;
  • # use other direction for counts
  • @a = @b if @a>@b;
  • # test if start or end count is out of range
  • # exit with the negation to save a character
  • exit ! grep $a[$_]>$m-2, 0,-1
  • '
  • echo $?
  • ```
  • [Try it online!][TIO-mptbi5b6]
  • [Perl 5]: https://www.perl.org/
  • [TIO-mptbi5b6]: https://tio.run/##pVldb9pQDH3nV2ScrAUVbtikvhS1zdP@R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ODvvpmCIdb1thyuLSg2obDeF2zPRKw9wFQszFJVZ24xIXoDAPMuTtu7MBHY/yTdNDXZVjvKD9KOZxjneF/5mZuIQJUvSIZB7NqDfmNiqGKzWwbfG5ry8TjF0fpV3WtLHBvirTIbcut6YpKXd17QxL5NRkclEjsZgWFuZq9dfnXLYYB@vaQtCEtHQVfBPrFEsGhoy4tK6C0jMlunvLAIbXVju7Y5o5Z3CPiPXbHPMAdzJw79InHurRILNbiIod/k4fpwitP0gGT173S2GE8nxbrb6w3@AQ "Perl 5 – Try It Online"
  • # [Perl 5], 109 bytes
  • Read stdin. Exits 1 if net, 0 if not.
  • ```bash
  • perl -00ae'@a=map{++$b[(pos)-1]while/#/g;y/#//||()}@F;$m=@a>@b?@a:@b;@a=@b
  • if@a>@b;exit!grep$a[$_]>$m-2,0,-1'
  • ```
  • When oriented with longer side vertical as shown in the challenge:
  • * nets have height 4 or 5
  • * nets never start or end with a "long" column (2+ for height 3; 3+ for height 4; 4+ for height 5) but non-nets always do
  • * for non-nets of height 3 the squares may not be connected when the other orientation is chosen
  • This simplifies to:
  • * non-nets have an start or end column containing more than height-2 squares
  • ```
  • printf "%s\n" '...#..' '####..' '...#..' '......' '......' '......' |
  • # -00 slurps records in paragraph mode
  • # -a loops over records, with lines stored in @F
  • perl -00ae'
  • # compute array of non-zero counts in rows
  • @a = map {
  • # compute part of array of non-zero counts in columns
  • ++$b[(pos)-1] while /#/g;
  • y/#// || ()
  • } @F;
  • # get length of longer direction
  • $m = @a>@b ? @a : @b;
  • # use other direction for counts
  • @a = @b if @a>@b;
  • # test if start or end count is out of range
  • # exit with the negation to save a character
  • exit ! grep $a[$_]>$m-2, 0,-1
  • '
  • echo $?
  • ```
  • [Try it online!][TIO-mptcu20d]
  • [Perl 5]: https://www.perl.org/
  • [TIO-mptcu20d]: https://tio.run/##pVnRTiJBEHznK/YoLkKEAS@5F4m6T/cTagwkq5IoEBZzZ9RfPw4QZGe2p7uG48F1yezQ013dVd07LxZPP1fIlk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xnGOd5WvucmPODzBckwSB170G9MDFVsVsvoe0NTPh66OFq/qnNtiWNjvFVlQ25cT3Ty8swLmti3yeigRFI7IzDMzcy1q69uOQzQr5e0AWFlKegs2AeWcBYNbXlQCb1kJEbrmBcWsaluatU2e9TqDAH/MSsOGeZruyObfpE497sSAzW4hKbf5OF6c4rj9IC069/ZfDmZTctVbzAY/QM "Perl 5 – Try It Online"
#3: Post edited by user avatar jhnc‭ · 2026-05-31T05:17:39Z (4 months ago)
invert for/map nesting to allows reusing each row read for both computations
  • # [Perl 5], 124 bytes
  • Read stdin. Exits 1 if net, 0 if not.
  • ```bash
  • perl -00ae'for$i(0..5){map/^.{$i}#/&&$b[$i]++,@F}@a=map{y/#//||()}@F;$m=@a>@b?@a:@b;@a=@b
  • if@a>@b;exit!grep$a[$_]>$m-2,0,-1'
  • ```
  • When oriented with longer side vertical as shown in the challenge:
  • * nets have height 4 or 5
  • * nets never start or end with a "long" column (3+ for height 4; 4+ for height 5)
  • * non-nets of height 3 always start or end with a "long" column (2+)
  • * the squares may not be connected when the other orientation is chosen
  • * the height 6 non-net is just a single long column (6)
  • This simplifies to:
  • * non-nets have an end column containing more than height-2 squares
  • ```
  • printf "%s\n" '...#..' '####..' '...#..' '......' '......' '......' |
  • # -00 slurps records in paragraph mode
  • # -a loops over records, with lines stored in @F
  • perl -00ne'
  • # array of non-zero counts of # in columns
  • for $i (0..5) {
  • map /^.{$i}#/ && $b[$i]++, @F
  • }
  • # array of non-zero counts of # in rows
  • @a = map{ y/#//||() } @F;
  • # get length of longer direction
  • $m = @a>@b ? @a : @b;
  • # use other direction for counts
  • @a = @b if @a>@b;
  • # test if either end count is out of range
  • # exit with the negation to save a character
  • exit ! grep $a[$_]>$m-2, 0,-1
  • '
  • echo $?
  • ```
  • [Try it online!][TIO-mpsuqjx1]
  • [Perl 5]: https://www.perl.org/
  • [TIO-mpsuqjx1]: https://tio.run/##pVldTyJBEHznV@xRq0KEgbvEF4m6T/4J9Qwk6JGcQFhMzi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Dio0rrPcF2zURYw8wGQszVdWeWwyIXgDAvIvT5i6MB/Y/SRdNTbZVlvKNtOMZxjneVr7nJjxQ5guSYRA79qDfmBiq2KyWwfeGpnw8dnG0flXn2hLHhniryIbcuJ7o5OWZFzSxb5PRUYnEdkZgmJuZaxdf3XIYoF8vaQPCwlLQWbAPLOEsGtryoBJ6yYiM1ikvLEJT3diqbfaoxRkC/mNW7DPMYbsTm36ROPe7EgM1uIim3@ThanOK0/SAtOvfyXQ@mozzVbvb7f8D "Perl 5 – Try It Online"
  • # [Perl 5], 118 bytes
  • Read stdin. Exits 1 if net, 0 if not.
  • ```bash
  • perl -00ae'@a=map{for$i(0..5){/^.{$i}#/&&$b[$i]++}y/#//||()}@F;$m=@a>@b?@a:@b;@a=@b
  • if@a>@b;exit!grep$a[$_]>$m-2,0,-1'
  • ```
  • When oriented with longer side vertical as shown in the challenge:
  • * nets have height 4 or 5
  • * nets never start or end with a "long" column (2+ for height 3; 3+ for height 4; 4+ for height 5) but non-nets always do
  • * for non-nets of height 3 the squares may not be connected when the other orientation is chosen
  • This simplifies to:
  • * non-nets have an start or end column containing more than height-2 squares
  • ```
  • printf "%s\n" '...#..' '####..' '...#..' '......' '......' '......' |
  • # -00 slurps records in paragraph mode
  • # -a loops over records, with lines stored in @F
  • perl -00ae'
  • # array of non-zero counts in rows
  • @a = map {
  • # array of non-zero counts in columns
  • for $i (0..5) {
  • /^.{$i}#/ && $b[$i]++
  • }
  • y/#// || ()
  • } @F;
  • # get length of longer direction
  • $m = @a>@b ? @a : @b;
  • # use other direction for counts
  • @a = @b if @a>@b;
  • # test if start or end count is out of range
  • # exit with the negation to save a character
  • exit ! grep $a[$_]>$m-2, 0,-1
  • '
  • echo $?
  • ```
  • [Try it online!][TIO-mptbi5b6]
  • [Perl 5]: https://www.perl.org/
  • [TIO-mptbi5b6]: https://tio.run/##pVldb9pQDH3nV2ScrAUVbtikvhS1zdP@RNtVINEOaQVEqLSK8tfHCuUjufG1z2V9SYMuxrGPf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xIXoDAPMuTtu7MBHY/yTdNDXZVjvKD9KOZxjneF/5mZuIQJUvSIZB7NqDfmNiqGKzWwbfG5ry8TjF0fpV3WtLHBvirTIbcut6YpKXd17QxL5NRkclEjsZgWFuZq9dfnXLYYB@vaQtCEtHQVfBPrFEsGhoy4tK6C0jMlunvLAIbXVju7Y5o5Z3CPiPXbHPMAdzJw79InHurRILNbiIod/k4fpwitP0gGT173S2GE8nxbrb6w3@AQ "Perl 5 – Try It Online"
#2: Post edited by user avatar jhnc‭ · 2026-05-30T21:23:23Z (4 months ago)
-a saves loading manually; reordering map saves a character
  • # [Perl 5], 135 bytes
  • Read stdin. Exits 1 if net, 0 if not.
  • ```bash
  • perl -00ne'@a=/\S+/g;for$i(0..5){map{$b[$i]++if/^.{$i}#/}@a}@a=map{y/#//||()}@a;$m=@a>@b?@a:@b;@a=@b
  • if@a>@b;exit!grep$a[$_]>$m-2,0,-1'
  • ```
  • When oriented with longer side vertical as shown in the challenge:
  • * nets have height 4 or 5
  • * nets never start or end with a "long" column (3+ for height 4; 4+ for height 5)
  • * non-nets of height 3 always start or end with a "long" column (2+)
  • * the squares may not be connected when the other orientation is chosen
  • * the height 6 non-net is just a single long column (6)
  • This simplifies to:
  • * non-nets have an end column containing more than height-2 squares
  • ```
  • printf "%s\n" '...#..' '####..' '...#..' '......' '......' '......' |
  • # -00 slurps records in paragraph mode
  • # -n loops over records
  • perl -00ne'
  • # array of the rows
  • @a = /\S+/g;
  • # array of non-zero counts of # in columns
  • for $i (0..5) {
  • map {
  • $b[$i]++ if /^.{$i}#/
  • } @a
  • }
  • # array of non-zero counts of # in rows
  • @a = map{ y/#//||() } @a;
  • # get length of longer direction
  • $m = @a>@b ? @a : @b;
  • # use other direction for counts
  • @a = @b if @a>@b;
  • # test if either end count is out of range
  • # exit with the negation to save a character
  • exit ! grep $a[$_]>$m-2, 0,-1
  • '
  • echo $?
  • ```
  • [Try it online!][TIO-mpsswa6h]
  • [Perl 5]: https://www.perl.org/
  • [TI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DLip5b0qU6RYnBq1azwEsysQLBmOrSM01bZ/nCleoLnD1/haMTBo5W8FU9QCtNRNQBx0DbsSWDMaA6@2YShhjX23K4NqDYucJ6X7BfEzH2AJOxMFNV7bnFgOgFAMy7OG3uwnjg@JV00dRkW20p30g7nmGc423le27CAz5fkAyD2LEH/cbEUMVmtQy@NzTl46mLo/WrOteWODbEW2U25Mb1RCcvz7ygiX2bjE5KJLYzAsPczFy7/OqWwwD9ekkbEJaWgs6CY2AJZ9HQlgeV0EtGZLTOeWERmurGVm2zRy3PEPAfs@Iqw3xud2bTLxLncVdioAYX0fSbPFxvTnGeHpB2/TtfrPL5rNh0e73ZPw "Perl 5 – Try It Online"
  • # [Perl 5], 124 bytes
  • Read stdin. Exits 1 if net, 0 if not.
  • ```bash
  • perl -00ae'for$i(0..5){map/^.{$i}#/&&$b[$i]++,@F}@a=map{y/#//||()}@F;$m=@a>@b?@a:@b;@a=@b
  • if@a>@b;exit!grep$a[$_]>$m-2,0,-1'
  • ```
  • When oriented with longer side vertical as shown in the challenge:
  • * nets have height 4 or 5
  • * nets never start or end with a "long" column (3+ for height 4; 4+ for height 5)
  • * non-nets of height 3 always start or end with a "long" column (2+)
  • * the squares may not be connected when the other orientation is chosen
  • * the height 6 non-net is just a single long column (6)
  • This simplifies to:
  • * non-nets have an end column containing more than height-2 squares
  • ```
  • printf "%s\n" '...#..' '####..' '...#..' '......' '......' '......' |
  • # -00 slurps records in paragraph mode
  • # -a loops over records, with lines stored in @F
  • perl -00ne'
  • # array of non-zero counts of # in columns
  • for $i (0..5) {
  • map /^.{$i}#/ && $b[$i]++, @F
  • }
  • # array of non-zero counts of # in rows
  • @a = map{ y/#//||() } @F;
  • # get length of longer direction
  • $m = @a>@b ? @a : @b;
  • # use other direction for counts
  • @a = @b if @a>@b;
  • # test if either end count is out of range
  • # exit with the negation to save a character
  • exit ! grep $a[$_]>$m-2, 0,-1
  • '
  • echo $?
  • ```
  • [Try it online!][TIO-mpsuqjx1]
  • [Perl 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i55Z08acoMXjVahZ4SSZWIBhTXXqmaeussnCl@gJnz1/h6ISBoxW8rwdopYmIOuAYaDu2ZDAG@LNvJmGIcb0thysDio0rrPcF2zURYw8wGQszVdWeWwyIXgDAvIvT5i6MB/Y/SRdNTbZVlvKNtOMZxjneVr7nJjxQ5guSYRA79qDfmBiq2KyWwfeGpnw8dnG0flXn2hLHhniryIbcuJ7o5OWZFzSxb5PRUYnEdkZgmJuZaxdf3XIYoF8vaQPCwlLQWbAPLOEsGtryoBJ6yYiM1ikvLEJT3diqbfaoxRkC/mNW7DPMYbsTm36ROPe7EgM1uIim3@ThanOK0/SAtOvfyXQ@mozzVbvb7f8D "Perl 5 – Try It Online"
#1: Initial revision by user avatar jhnc‭ · 2026-05-30T21:00:44Z (4 months ago)
# [Perl 5], 135 bytes

Read stdin. Exits 1 if net, 0 if not.

```bash
perl -00ne'@a=/\S+/g;for$i(0..5){map{$b[$i]++if/^.{$i}#/}@a}@a=map{y/#//||()}@a;$m=@a>@b?@a:@b;@a=@b
if@a>@b;exit!grep$a[$_]>$m-2,0,-1'
```

When oriented with longer side vertical as shown in the challenge:
* nets have height 4 or 5
* nets never start or end with a "long" column (3+ for height 4; 4+ for height 5)
* non-nets of height 3 always start or end with a "long" column (2+)
  * the squares may not be connected when the other orientation is chosen
* the height 6 non-net is just a single long column (6)

This simplifies to:
* non-nets have an end column containing more than height-2 squares

```
printf "%s\n" '...#..' '####..' '...#..' '......' '......' '......' |

# -00 slurps records in paragraph mode
# -n loops over records
perl -00ne'
    # array of the rows
    @a = /\S+/g;

    # array of non-zero counts of # in columns
    for $i (0..5) {
        map {
            $b[$i]++ if /^.{$i}#/
        } @a
    }

    # array of non-zero counts of # in rows
    @a = map{ y/#//||() } @a;

    # get length of longer direction
    $m = @a>@b ? @a : @b;

    # use other direction for counts
    @a = @b if @a>@b;

    # test if either end count is out of range
    # exit with the negation to save a character
    exit ! grep $a[$_]>$m-2, 0,-1
'

echo $?
```


[Try it online!][TIO-mpsswa6h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