PWC 180
PWC 180 This week saw two light challenges, which I was able to do in both Perl 5 and Raku despite being busy at work. I also did Challenge 2 in Julia, but not Challenge 1. Challenge 1 is a string-handling task for which Julia is not a typical choice. Challenge 1 (First unique character) The challenge here is to find the first unique character in a given string. The string is likely to be short (a long string would be unlikely to have unique characters, if naturally generated from a much smaller number of characters). So a two-loop solution should be efficient enough: one loop to count the occurrences of each character using a hash, and the second to loop through the characters again, checking the number of occurrences from the hash, and stopping at the first character for which the number of occurrences equals 1. A twist is that we are asked to return the index position of the character, not the character itself. I give my Perl 5 subroutine a somewhat retr...