aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <mohammad.anwar@yahoo.com>2024-09-18 20:18:52 +0100
committerMohammad Sajid Anwar <mohammad.anwar@yahoo.com>2024-09-18 20:18:52 +0100
commit0052ec63ca70eaa6d9ffb1926c294dbfd85f8c05 (patch)
treeb36287679c83fedbccaa97d8fe75c7308d5779d7
parent467f3f3ee7cbef95158ddf81a2187e1a997acfc1 (diff)
downloadperlweeklychallenge-club-0052ec63ca70eaa6d9ffb1926c294dbfd85f8c05.tar.gz
perlweeklychallenge-club-0052ec63ca70eaa6d9ffb1926c294dbfd85f8c05.tar.bz2
perlweeklychallenge-club-0052ec63ca70eaa6d9ffb1926c294dbfd85f8c05.zip
- Added solutions by Paulo Custodio.
- Added solutions by Peter Campbell Smith. - Added solutions by Robert Ransbottom. - Added solutions by Feng Chang. - Added solutions by PokGoPun. - Added solutions by Peter Pentchev. - Added solutions by Santiago Leyva. - Added solutions by Robbie Hatley. - Added solutions by Ulrich Rieke. - Added solutions by Laurent Rosenfeld.
-rw-r--r--challenge-286/santiago-leyva/perl/ch-1.pl (renamed from challenge-286/santiago-leyva/perl/ch-01.pl)0
-rw-r--r--challenge-286/santiago-leyva/perl/ch-2.pl (renamed from challenge-286/santiago-leyva/perl/ch-02.pl)0
-rw-r--r--challenge-287/laurent-rosenfeld/blog.txt1
-rw-r--r--challenge-287/laurent-rosenfeld/blog1.txt1
-rw-r--r--challenge-287/laurent-rosenfeld/perl/ch-1.pl32
-rw-r--r--challenge-287/laurent-rosenfeld/perl/ch-2.pl19
-rw-r--r--challenge-287/laurent-rosenfeld/raku/ch-1.raku27
-rw-r--r--challenge-287/laurent-rosenfeld/raku/ch-2.raku17
-rw-r--r--challenge-287/santiago-leyva/perl/ch-1.pl (renamed from challenge-287/santiago-leyva/perl/ch-01.pl)0
-rw-r--r--challenge-287/santiago-leyva/perl/ch-2.pl (renamed from challenge-287/santiago-leyva/perl/ch-02.pl)0
-rwxr-xr-xchallenge-287/ulrich-rieke/cpp/ch-1.cpp71
-rwxr-xr-xchallenge-287/ulrich-rieke/cpp/ch-2.cpp22
-rwxr-xr-xchallenge-287/ulrich-rieke/haskell/ch-1.hs32
-rwxr-xr-xchallenge-287/ulrich-rieke/haskell/ch-2.hs64
-rwxr-xr-xchallenge-287/ulrich-rieke/perl/ch-1.pl31
-rwxr-xr-xchallenge-287/ulrich-rieke/perl/ch-2.pl19
-rwxr-xr-xchallenge-287/ulrich-rieke/raku/ch-1.raku28
-rwxr-xr-xchallenge-287/ulrich-rieke/raku/ch-2.raku16
-rwxr-xr-xchallenge-287/ulrich-rieke/rust/ch-1.rs37
-rwxr-xr-xchallenge-287/ulrich-rieke/rust/ch-2.rs18
-rw-r--r--stats/pwc-challenge-286.json307
-rw-r--r--stats/pwc-current.json304
-rw-r--r--stats/pwc-language-breakdown-2019.json634
-rw-r--r--stats/pwc-language-breakdown-2020.json366
-rw-r--r--stats/pwc-language-breakdown-2021.json400
-rw-r--r--stats/pwc-language-breakdown-2022.json770
-rw-r--r--stats/pwc-language-breakdown-2023.json774
-rw-r--r--stats/pwc-language-breakdown-2024.json298
-rw-r--r--stats/pwc-language-breakdown-summary.json52
-rw-r--r--stats/pwc-leaders.json744
-rw-r--r--stats/pwc-summary-1-30.json54
-rw-r--r--stats/pwc-summary-121-150.json44
-rw-r--r--stats/pwc-summary-151-180.json114
-rw-r--r--stats/pwc-summary-181-210.json86
-rw-r--r--stats/pwc-summary-211-240.json58
-rw-r--r--stats/pwc-summary-241-270.json108
-rw-r--r--stats/pwc-summary-271-300.json102
-rw-r--r--stats/pwc-summary-301-330.json60
-rw-r--r--stats/pwc-summary-31-60.json100
-rw-r--r--stats/pwc-summary-61-90.json108
-rw-r--r--stats/pwc-summary-91-120.json116
-rw-r--r--stats/pwc-summary.json710
-rw-r--r--stats/pwc-yearly-language-summary.json90
43 files changed, 3714 insertions, 3120 deletions
diff --git a/challenge-286/santiago-leyva/perl/ch-01.pl b/challenge-286/santiago-leyva/perl/ch-1.pl
index c0b9890959..c0b9890959 100644
--- a/challenge-286/santiago-leyva/perl/ch-01.pl
+++ b/challenge-286/santiago-leyva/perl/ch-1.pl
diff --git a/challenge-286/santiago-leyva/perl/ch-02.pl b/challenge-286/santiago-leyva/perl/ch-2.pl
index 0ee3d29728..0ee3d29728 100644
--- a/challenge-286/santiago-leyva/perl/ch-02.pl
+++ b/challenge-286/santiago-leyva/perl/ch-2.pl
diff --git a/challenge-287/laurent-rosenfeld/blog.txt b/challenge-287/laurent-rosenfeld/blog.txt
new file mode 100644
index 0000000000..7a3a66c7f0
--- /dev/null
+++ b/challenge-287/laurent-rosenfeld/blog.txt
@@ -0,0 +1 @@
+https://blogs.perl.org/users/laurent_r/2024/09/perl-weekly-challenge-287-strong-password.html
diff --git a/challenge-287/laurent-rosenfeld/blog1.txt b/challenge-287/laurent-rosenfeld/blog1.txt
new file mode 100644
index 0000000000..24111c72a2
--- /dev/null
+++ b/challenge-287/laurent-rosenfeld/blog1.txt
@@ -0,0 +1 @@
+https://blogs.perl.org/users/laurent_r/2024/09/perl-weekly-challenge-287-valid-number.html
diff --git a/challenge-287/laurent-rosenfeld/perl/ch-1.pl b/challenge-287/laurent-rosenfeld/perl/ch-1.pl
new file mode 100644
index 0000000000..3639c82386
--- /dev/null
+++ b/challenge-287/laurent-rosenfeld/perl/ch-1.pl
@@ -0,0 +1,32 @@
+use strict;
+use warnings;
+use feature 'say'; uppercase chara cter class
+
+sub strong_password {
+ my $pwd = shift;
+ my $count = 0;
+ # At least one uppercase letter
+ $pwd .= "A" and $count++ if $pwd !~ /[A-Z]/;
+ # At least one lowercase letter
+ $pwd .= "b" and $count++ if $pwd !~ /[a-z]/;
+ # At least one digit
+ $pwd .= "3" and $count++ if $pwd !~ /\d/;
+ # no repeating characters
+ while ($pwd =~ /(.)\1{2}/) {
+ my $subst = chr (1 + ord $1);
+ $pwd =~ s/(.)$1{2}/$1$1$subst/;
+ $count++;
+ }
+ for my $ch ('a'..'z') {
+ last if length $pwd >= 6;
+ $count++;
+ $pwd .= $ch
+ }
+ return $count;
+}
+
+my @tests = qw<a aB2 PaaSW0rd Paaasw0rd aaaaa foob>;
+for my $test (@tests) {
+ printf "%-10s => ", $test;
+ say strong_password $test;
+}
diff --git a/challenge-287/laurent-rosenfeld/perl/ch-2.pl b/challenge-287/laurent-rosenfeld/perl/ch-2.pl
new file mode 100644
index 0000000000..074284f55e
--- /dev/null
+++ b/challenge-287/laurent-rosenfeld/perl/ch-2.pl
@@ -0,0 +1,19 @@
+use strict;
+use warnings;
+use feature 'say';
+
+sub valid_number {
+ my $in = shift;
+ return "True" if $in =~
+ /^[+-]? # start of string & optional + or - sign
+ ( \d+\.? # digit(s) followed by a dot
+ | \d*\.\d+) # or digits with a dot inside or before
+ ([eE][+-]\d+)? # optional positive or negative exponent
+ $/x; # end of string & option to enable comments
+ return "False";
+}
+my @tests = qw<1 a . 1.2e4.2 -1 +1E-8 .44 16 12.5 5e17e3 foo>;
+for my $test (@tests) {
+ printf "%-10s => ", $test;
+ say valid_number $test;
+}
diff --git a/challenge-287/laurent-rosenfeld/raku/ch-1.raku b/challenge-287/laurent-rosenfeld/raku/ch-1.raku
new file mode 100644
index 0000000000..785ab93054
--- /dev/null
+++ b/challenge-287/laurent-rosenfeld/raku/ch-1.raku
@@ -0,0 +1,27 @@
+sub strong-password ($pwd is copy) {
+ my $count = 0;
+ # At least one uppercase letter
+ $pwd ~= "A" and $count++ if $pwd !~~ /<:Lu>/;
+ # At least one lowercase letter
+ $pwd ~= "b" and $count++ if $pwd !~~ /<:Ll>/;
+ # At least one digit
+ $pwd ~= "3" and $count++ if $pwd !~~ /\d/;
+ # no repeating characters
+ while $pwd ~~ /(.)$0**2/ {
+ my $subst = ($0.ord + 1).chr;
+ $pwd ~~ s/(.)$0**2/$0$0$subst/;
+ $count++;
+ }
+ for 'a'..'z' -> $ch {
+ last if $pwd.chars >= 6;
+ $count++;
+ $pwd ~= $ch
+ }
+ return $count;
+}
+
+my @tests = <a aB2 PaaSW0rd Paaasw0rd aaaaa foob>;
+for @tests -> $test {
+ printf "%-10s => ", $test;
+ say strong-password $test;
+}
diff --git a/challenge-287/laurent-rosenfeld/raku/ch-2.raku b/challenge-287/laurent-rosenfeld/raku/ch-2.raku
new file mode 100644
index 0000000000..d9e0999221
--- /dev/null
+++ b/challenge-287/laurent-rosenfeld/raku/ch-2.raku
@@ -0,0 +1,17 @@
+sub valid-number ($in) {
+ my token sign { <[+-]> }
+ my regex integer { <sign>? \d+ }
+ my token exponent { <[eE]> <integer> }
+ my token decimal {
+ <integer> '.'? | <sign>? '.'? \d+ | <integer> '.' \d+
+ }
+ my regex float { <decimal> <exponent> }
+ my token number { <float> | (<decimal> <exponent>?) }
+
+ return so $in ~~ /^ <number> $/ ;
+}
+
+for <1 a . 1.2e4.2 -1 +1E-8 .44 16 12.5 5e17e3 foo> -> $test {
+ printf "%-10s => ", $test;
+ say valid-number $test;
+}
diff --git a/challenge-287/santiago-leyva/perl/ch-01.pl b/challenge-287/santiago-leyva/perl/ch-1.pl
index f545e66ffb..f545e66ffb 100644
--- a/challenge-287/santiago-leyva/perl/ch-01.pl
+++ b/challenge-287/santiago-leyva/perl/ch-1.pl
diff --git a/challenge-287/santiago-leyva/perl/ch-02.pl b/challenge-287/santiago-leyva/perl/ch-2.pl
index 8f3dc1cba6..8f3dc1cba6 100644
--- a/challenge-287/santiago-leyva/perl/ch-02.pl
+++ b/challenge-287/santiago-leyva/perl/ch-2.pl
diff --git a/challenge-287/ulrich-rieke/cpp/ch-1.cpp b/challenge-287/ulrich-rieke/cpp/ch-1.cpp
new file mode 100755
index 0000000000..6048d7476f
--- /dev/null
+++ b/challenge-287/ulrich-rieke/cpp/ch-1.cpp
@@ -0,0 +1,71 @@
+#include <iostream>
+#include <string>
+#include <regex>
+#include <vector>
+#include <numeric>
+
+int main( ) {
+ std::cout << "Enter a password!\n" ;
+ std::string word ;
+ std::cin >> word ;
+ int totalsteps = 0 ;
+ const std::regex rgx1("[a-z]") ;
+ const std::regex rgx2("[A-Z]") ;
+ const std::regex rgx3("\\d") ;
+ int len = word.length( ) ;
+ if ( len < 6 ) {
+ totalsteps += 6 - len ;
+ }
+ //beware : it took me quite some time to find out that
+ //std::regex_match does not return the right result!!
+ //if you want to check whether a given regular expression
+ //such as \d matches I had to use std::regex_search!!!
+ if ( ! std::regex_search( word , rgx1 )) {
+ if ( len >= 6 ) {
+ totalsteps++ ;
+ }
+ }
+ if ( ! std::regex_search( word , rgx2 )) {
+ if ( len >= 6 ) {
+ totalsteps++ ;
+ }
+ }
+ if ( ! std::regex_search( word , rgx3 )) {
+ if ( len >= 6 ) {
+ totalsteps++ ;
+ }
+ }
+ //std::regex appears not to allow backreferences...?
+ //so, to prevent too many identical neighbouring letters
+ //I group the letters , divide their lengths by 3 and sum the
+ //quotients up ( inspired by Haskell where this operation is so easy
+ //to perform!!!
+ std::vector<std::string> neighbouring_letters ;
+ std::string currentWord ;
+ //imitate Haskell's group function!
+ for ( auto it = word.begin( ) ; it != word.end( ) ; ++it ) {
+ if ( currentWord.empty( ) )
+ currentWord.push_back( *it ) ;
+ else {
+ char last_char = currentWord.back( ) ;
+ if ( last_char == *it ) {
+ currentWord.push_back( *it ) ;
+ }
+ else {
+ neighbouring_letters.push_back( currentWord ) ;
+ currentWord.clear( ) ;
+ currentWord.push_back( *it ) ;
+ }
+ }
+ }
+ neighbouring_letters.push_back( currentWord ) ;
+ std::vector<int> grouplengths ;
+ for ( auto v : neighbouring_letters ) {
+ grouplengths.push_back( v.length( ) / 3 ) ;
+ }
+ int replacements = std::accumulate( grouplengths.begin( ) ,
+ grouplengths.end( ) , 0 ) ;
+ totalsteps += replacements ;
+ std::cout << totalsteps << '\n' ;
+ return 0 ;
+}
diff --git a/challenge-287/ulrich-rieke/cpp/ch-2.cpp b/challenge-287/ulrich-rieke/cpp/ch-2.cpp
new file mode 100755
index 0000000000..b5dc14d07a
--- /dev/null
+++ b/challenge-287/ulrich-rieke/cpp/ch-2.cpp
@@ -0,0 +1,22 @@
+#include <iostream>
+#include <string>
+#include <regex>
+
+int main( ) {
+ std::cout << "Enter a string!\n" ;
+ std::string word ;
+ std::cin >> word ;
+ std::string inte {R"(^[-+]?\d+([eE]?[-+]?\d+)*$)"} ;
+ std::string decifirst {R"(^[-+]?\d+\.([eE]?[-+]?\d+)*$|^[-+]?\d+\.\d+([eE]?[+-]?\d+)*$)"} ;
+ std::string decisecond {R"(^[+-]?\.\d+([eE]?[+-]?\d+$)*$)" } ;
+ std::regex integer( inte ) ;
+ std::regex decimalfirst ( decifirst ) ;
+ std::regex decimalsecond ( decisecond ) ;
+ if ( std::regex_match( word , integer ) || std::regex_match( word , decimalfirst ) ||
+ std::regex_match( word , decimalsecond ) )
+ std::cout << "true" ;
+ else
+ std::cout << "false" ;
+ std::cout << '\n' ;
+ return 0 ;
+}
diff --git a/challenge-287/ulrich-rieke/haskell/ch-1.hs b/challenge-287/ulrich-rieke/haskell/ch-1.hs
new file mode 100755
index 0000000000..481f603eee
--- /dev/null
+++ b/challenge-287/ulrich-rieke/haskell/ch-1.hs
@@ -0,0 +1,32 @@
+module Challenge287
+ where
+import Data.Char ( isUpper , isLower , isDigit )
+import Data.List ( group )
+
+solution :: String -> Int
+solution word = subterm1 + subterm2 + subterm3 + subterm4 + subterm5
+ where
+ l :: Int
+ l = length word
+ subterm1 :: Int
+ subterm1 = if l < 6 then 6 - l else 0
+ subterm2 :: Int
+ subterm2 = if (length $ filter isLower word) < 1
+ then if l >= 6 then 1 else 0
+ else 0
+ subterm3 :: Int
+ subterm3 = if (length $ filter isUpper word) < 1
+ then if l >= 6 then 1 else 0
+ else 0
+ subterm4 :: Int
+ subterm4 = if (length $ filter isDigit word) < 1
+ then if l >= 6 then 1 else 0
+ else 0
+ subterm5 :: Int -- count the number of identical neighbouring letters
+ subterm5 = sum $ map (\li -> div ( length li ) 3 ) $ group word
+
+main :: IO ( )
+main = do
+ putStrLn "Enter a password!"
+ password <- getLine
+ print $ solution password
diff --git a/challenge-287/ulrich-rieke/haskell/ch-2.hs b/challenge-287/ulrich-rieke/haskell/ch-2.hs
new file mode 100755
index 0000000000..e4eb5ecc89
--- /dev/null
+++ b/challenge-287/ulrich-rieke/haskell/ch-2.hs
@@ -0,0 +1,64 @@
+module Challenge287_2
+ where
+import Data.Char
+import Text.ParserCombinators.ReadP
+import Control.Applicative ((<|>))
+import Data.List ( init )
+
+sign :: ReadP Char
+sign = do
+ char '-' <|> char '+'
+
+numbers :: ReadP String
+numbers = do
+ many1 $ satisfy isDigit
+
+integer :: ReadP String
+integer = do
+ si <- option ' ' sign
+ nums <- numbers
+ if si /= ' ' then pure ([si] ++ nums) else pure nums
+
+expo :: ReadP String
+expo = do
+ c <- char 'e' <|> char 'E'
+ number <- integer
+ pure ([c] ++ number)
+
+decimalfirst :: ReadP String
+decimalfirst = do
+ si <- option ' ' sign
+ num <- numbers
+ char '.'
+ if si /= ' ' then pure ([si] ++ num ++ "." ) else pure (num ++ ".")
+
+decimalsecond :: ReadP String
+decimalsecond = do
+ si <- option ' ' sign
+ num <- numbers
+ char '.'
+ numgroup <- numbers
+ if si /= ' ' then pure ([si] ++ num ++ "." ++ numgroup ) else pure( num ++
+ "." ++ numgroup )
+
+decimalthird :: ReadP String
+decimalthird = do
+ si <- option ' ' sign
+ char '.'
+ num <- numbers
+ if si /= ' ' then pure ([si] ++ "." ++ num ) else pure ("." ++ num)
+
+validNum :: ReadP String
+validNum = do
+ numgroup <- ( integer >> option " " expo ) <|> ( decimalsecond >>
+ option " " expo ) <|> (decimalthird >> option " " expo ) <|>
+ (decimalfirst >> option " " expo )
+ if last numgroup == ' ' then pure ( init numgroup ) else pure numgroup
+
+main :: IO ( )
+main = do
+ putStrLn "Enter a string!"
+ string <- getLine
+ let p = readP_to_S validNum string
+ if null p then print "false" else if ( null $ snd $ last p ) then print "true"
+ else print "false"
diff --git a/challenge-287/ulrich-rieke/perl/ch-1.pl b/challenge-287/ulrich-rieke/perl/ch-1.pl
new file mode 100755
index 0000000000..3e395be14c
--- /dev/null
+++ b/challenge-287/ulrich-rieke/perl/ch-1.pl
@@ -0,0 +1,31 @@
+#!/usr/bin/perl ;
+use strict ;
+use warnings ;
+use feature 'say' ;
+
+say "Enter a password!" ;
+my $word = <STDIN> ;
+chomp $word ;
+my $totalsteps = 0 ;
+if ( length $word < 6 ) {
+ $totalsteps += 6 - length $word ;#complement the word!
+}
+if ( $word !~ /[a-z]/ ) {
+ if ( length $word >= 6 ) { #replace one character
+ $totalsteps += 1 ;
+ }
+}
+if ( $word !~ /[A-Z]/ ) {
+ if ( length $word >= 6 ) {#replace one character
+ $totalsteps += 1 ;
+ }
+}
+if ( $word !~ /\d/ ) {
+ if ( length $word >= 6 ) {#replace one character
+ $totalsteps += 1 ;
+ }
+}
+if ( $word =~ /(.)\1\1/ ) {#replace one character
+ $totalsteps += 1 ;
+}
+say $totalsteps ;
diff --git a/challenge-287/ulrich-rieke/perl/ch-2.pl b/challenge-287/ulrich-rieke/perl/ch-2.pl
new file mode 100755
index 0000000000..b860194272
--- /dev/null
+++ b/challenge-287/ulrich-rieke/perl/ch-2.pl
@@ -0,0 +1,19 @@
+#!/usr/bin/perl ;
+use strict ;
+use warnings ;
+use feature 'say' ;
+
+say "Enter a string!" ;
+my $string = <STDIN> ;
+chomp $string ;
+my $sign = qr/[+\-]??/ ;
+my $integer = qr/$sign*\d+/ ;
+my $exponent = qr/[eE]$integer/ ;
+my $decimal = qr/^$sign*\d+\.$|^$sign*\d+\.\d$|^$sign*\.\d+$/ ;
+my $valid = qr/^$integer$exponent*$|^$decimal$exponent*$/ ;
+if ( $string =~ /$valid/ ) {
+ say "true" ;
+}
+else {
+ say "false" ;
+}
diff --git a/challenge-287/ulrich-rieke/raku/ch-1.raku b/challenge-287/ulrich-rieke/raku/ch-1.raku
new file mode 100755
index 0000000000..f7c6d65762
--- /dev/null
+++ b/challenge-287/ulrich-rieke/raku/ch-1.raku
@@ -0,0 +1,28 @@
+use v6 ;
+
+say "Enter a password!" ;
+my $word = $*IN.get ;
+my $totalsteps = 0 ;
+my $len = $word.chars ;
+if ( $len < 6 ) {
+ $totalsteps += 6 - $len ;
+}
+if ( $word !~~ /<[a..z]>/ ) {
+ if ( $len >= 6 ) {
+ $totalsteps++ ;
+ }
+}
+if ( $word !~~ /<[A..Z]>/ ) {
+ if ( $len >= 6 ) {
+ $totalsteps++ ;
+ }
+}
+if ( $word !~~ /\d/ ) {
+ if ( $len >= 6 ) {
+ $totalsteps++ ;
+ }
+}
+if ( $word ~~ /(.) $0 $0/ ) {
+ $totalsteps++ ;
+}
+$totalsteps.say ;
diff --git a/challenge-287/ulrich-rieke/raku/ch-2.raku b/challenge-287/ulrich-rieke/raku/ch-2.raku
new file mode 100755
index 0000000000..a63d1b19fa
--- /dev/null
+++ b/challenge-287/ulrich-rieke/raku/ch-2.raku
@@ -0,0 +1,16 @@
+use v6 ;
+
+say "Enter a string!" ;
+my $string = $*IN.get ;
+my regex sign { <[- +]> } ;
+my regex expo { <[e E]> <sign>? \d+ } ;
+my regex integer { <sign>? \d+ <expo>?} ;
+my regex decimal { <sign>? \d+ \. <expo>? | <sign>? \d+ \. \d+ <expo>? |
+ <sign>? \. \d+ <expo>? } ;
+my regex valid {^ <integer> $ | ^ <decimal> $} ;
+if ( $string ~~ / <valid> / ) {
+ say "true" ;
+}
+else {
+ say "false" ;
+}
diff --git a/challenge-287/ulrich-rieke/rust/ch-1.rs b/challenge-287/ulrich-rieke/rust/ch-1.rs
new file mode 100755
index 0000000000..e8a5c93945
--- /dev/null
+++ b/challenge-287/ulrich-rieke/rust/ch-1.rs
@@ -0,0 +1,37 @@
+use std::io ;
+use fancy_regex::Regex ; //this crate only supports Perl's backreferences!
+
+fn main() {
+ println!("Enter a word!");
+ let mut inline : String = String::new( ) ;
+ io::stdin( ).read_line( &mut inline ).unwrap( ) ;
+ let entered_line : &str = inline.as_str( ).trim( ) ;
+ let re1 = Regex::new(r"[a-z]").unwrap( ) ;
+ let re2 = Regex::new(r"[A-Z]").unwrap( ) ;
+ let re3 = Regex::new(r"\d").unwrap( ) ;
+ let re4 = Regex::new(r"(.)\1\1").unwrap( ) ;
+ let mut totalsteps : u16 = 0 ;
+ let len : u16 = entered_line.len( ) as u16 ;
+ if len < 6 {
+ totalsteps += 6 - len ;
+ }
+ if ! re1.is_match( entered_line ).unwrap( ) {
+ if len >= 6 {
+ totalsteps += 1 ;
+ }
+ }
+ if ! re2.is_match( entered_line ).unwrap( ) {
+ if len >= 6 {
+ totalsteps += 1 ;
+ }
+ }
+ if ! re3.is_match( entered_line ).unwrap( ) {
+ if len >= 6 {
+ totalsteps += 1 ;
+ }
+ }
+ if re4.is_match( entered_line ).unwrap( ) {
+ totalsteps += 1 ;
+ }
+ println!("{}" , totalsteps ) ;
+}
diff --git a/challenge-287/ulrich-rieke/rust/ch-2.rs b/challenge-287/ulrich-rieke/rust/ch-2.rs
new file mode 100755
index 0000000000..44e5ca7e50
--- /dev/null
+++ b/challenge-287/ulrich-rieke/rust/ch-2.rs
@@ -0,0 +1,18 @@
+use std::io ;
+use regex::Regex ;
+
+fn main() {
+ println!("Enter a string!");
+ let mut inline : String = String::new( ) ;
+ io::stdin( ).read_line( &mut inline ).unwrap( ) ;
+ let entered_line : &str = inline.as_str( ).trim( ) ;
+ let integer = Regex::new( r"^[+-]?\d+([eE]?[+-]?\d+)*$" ).unwrap( ) ;
+ let decimal = Regex::new( r"^[-+]?\d+\.([eE]?[+-]?\d+)*$|^[-+]*\d+\.
+ \d+([eE]?[+-]?\d+)*$|^[-+]?\.\d+([eE]?[+-]?\d+)*$").unwrap( ) ;
+ if integer.is_match( entered_line ) || decimal.is_match( entered_line ) {
+ println!("true") ;
+ }
+ else {
+ println!("false") ;
+ }
+}
diff --git a/stats/pwc-challenge-286.json b/stats/pwc-challenge-286.json
index 86e9fa22bc..82f3a970e3 100644
--- a/stats/pwc-challenge-286.json
+++ b/stats/pwc-challenge-286.json
@@ -2,16 +2,17 @@
"drilldown" : {
"series" : [
{
+ "name" : "Alexander Karelas",
+ "id" : "Alexander Karelas",
"data" : [
[
"Perl",
1
]
- ],
- "id" : "Alexander Karelas",
- "name" : "Alexander Karelas"
+ ]
},
{
+ "id" : "Ali Moradi",
"data" : [
[
"Perl",
@@ -26,8 +27,7 @@
1
]
],
- "name" : "Ali Moradi",
- "id" : "Ali Moradi"
+ "name" : "Ali Moradi"
},
{
"data" : [
@@ -40,8 +40,6 @@
"name" : "Andrew Schneider"
},
{
- "name" : "Arne Sommer",
- "id" : "Arne Sommer",
"data" : [
[
"Raku",
@@ -51,19 +49,22 @@
"Blog",
1
]
- ]
+ ],
+ "id" : "Arne Sommer",
+ "name" : "Arne Sommer"
},
{
+ "id" : "Asher Harvey-Smith",
"data" : [
[
"Raku",
1
]
],
- "id" : "Asher Harvey-Smith",
"name" : "Asher Harvey-Smith"
},
{
+ "name" : "Athanasius",
"data" : [
[
"Perl",
@@ -74,18 +75,17 @@
2
]
],
- "id" : "Athanasius",
- "name" : "Athanasius"
+ "id" : "Athanasius"
},
{
+ "name" : "BarrOff",
+ "id" : "BarrOff",
"data" : [
[
"Raku",
1
]
- ],
- "name" : "BarrOff",
- "id" : "BarrOff"
+ ]
},
{
"data" : [
@@ -98,17 +98,16 @@
"name" : "Bob Lied"
},
{
+ "name" : "Cheok-Yin Fung",
"data" : [
[
"Perl",
1
]
],
- "name" : "Cheok-Yin Fung",
"id" : "Cheok-Yin Fung"
},
{
- "id" : "David Ferrone",
"name" : "David Ferrone",
"data" : [
[
@@ -119,21 +118,22 @@
"Blog",
1
]
- ]
+ ],
+ "id" : "David Ferrone"
},
{
- "id" : "E. Choroba",
"name" : "E. Choroba",
"data" : [
[
"Perl",
2
]
- ]
+ ],
+ "id" : "E. Choroba"
},
{
- "id" : "Feng Chang",
"name" : "Feng Chang",
+ "id" : "Feng Chang",
"data" : [
[
"Raku",
@@ -142,6 +142,7 @@
]
},
{
+ "name" : "Jaldhar H. Vyas",
"data" : [
[
"Perl",
@@ -156,8 +157,7 @@