aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2024-06-18 20:32:12 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2024-06-18 20:32:12 +0100
commitffc47a8850ee877978e371d11a01a028862a3f9d (patch)
tree08663f3c685932bcd7ab882a6fa121523ab2011d
parentff8ed1548d7b07b46d8a6d311620ff9121608ebf (diff)
downloadperlweeklychallenge-club-ffc47a8850ee877978e371d11a01a028862a3f9d.tar.gz
perlweeklychallenge-club-ffc47a8850ee877978e371d11a01a028862a3f9d.tar.bz2
perlweeklychallenge-club-ffc47a8850ee877978e371d11a01a028862a3f9d.zip
- Added solutions by Eric Cheung.
- Added solutions by Ulrich Rieke. - Added solutions by E. Choroba. - Added solutions by PokGoPun. - Added solutions by Mark Anderson. - Added solutions by Peter Meszaros. - Added solutions by Mariano Spadaccini. - Added solutions by Roger Bell_West. - Added solutions by Thomas Kohler. - Added solutions by Dave Jacoby.
-rwxr-xr-xchallenge-274/eric-cheung/python/ch-1.py17
-rwxr-xr-xchallenge-274/eric-cheung/python/ch-2.py36
-rwxr-xr-xchallenge-274/ulrich-rieke/cpp/ch-1.cpp43
-rwxr-xr-xchallenge-274/ulrich-rieke/cpp/ch-2.cpp90
-rwxr-xr-xchallenge-274/ulrich-rieke/haskell/ch-1.hs17
-rwxr-xr-xchallenge-274/ulrich-rieke/haskell/ch-2.hs51
-rwxr-xr-xchallenge-274/ulrich-rieke/perl/ch-1.pl28
-rwxr-xr-xchallenge-274/ulrich-rieke/perl/ch-2.pl72
-rwxr-xr-xchallenge-274/ulrich-rieke/raku/ch-1.raku24
-rwxr-xr-xchallenge-274/ulrich-rieke/raku/ch-2.raku50
-rwxr-xr-xchallenge-274/ulrich-rieke/rust/ch-1.rs45
-rwxr-xr-xchallenge-274/ulrich-rieke/rust/ch-2.rs68
-rw-r--r--stats/pwc-challenge-273.json722
-rw-r--r--stats/pwc-current.json688
-rw-r--r--stats/pwc-language-breakdown-summary.json48
-rw-r--r--stats/pwc-language-breakdown.json1899
-rw-r--r--stats/pwc-leaders.json452
-rw-r--r--stats/pwc-summary-1-30.json96
-rw-r--r--stats/pwc-summary-121-150.json34
-rw-r--r--stats/pwc-summary-151-180.json36
-rw-r--r--stats/pwc-summary-181-210.json100
-rw-r--r--stats/pwc-summary-211-240.json102
-rw-r--r--stats/pwc-summary-241-270.json108
-rw-r--r--stats/pwc-summary-271-300.json114
-rw-r--r--stats/pwc-summary-301-330.json52
-rw-r--r--stats/pwc-summary-31-60.json38
-rw-r--r--stats/pwc-summary-61-90.json64
-rw-r--r--stats/pwc-summary-91-120.json104
-rw-r--r--stats/pwc-summary.json56
29 files changed, 2999 insertions, 2255 deletions
diff --git a/challenge-274/eric-cheung/python/ch-1.py b/challenge-274/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..8c26012d10
--- /dev/null
+++ b/challenge-274/eric-cheung/python/ch-1.py
@@ -0,0 +1,17 @@
+
+## strSentence = "I love Perl" ## Example 1
+## strSentence = "Perl and Raku are friends" ## Example 2
+strSentence = "The Weekly Challenge" ## Example 3
+
+arrVowel = ["a", "e", "i", "o", "u"]
+
+strOutput = ""
+arrOutput = []
+
+for nIndx, strLoop in enumerate(strSentence.split()):
+
+ strOutput = (strLoop if strLoop[0].lower() in arrVowel else strLoop[1:] + strLoop[0])
+ strOutput = strOutput + "ma" + "a" * (nIndx + 1)
+ arrOutput.append(strOutput)
+
+print (" ".join(arrOutput))
diff --git a/challenge-274/eric-cheung/python/ch-2.py b/challenge-274/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..4d7b01d69a
--- /dev/null
+++ b/challenge-274/eric-cheung/python/ch-2.py
@@ -0,0 +1,36 @@
+
+## arrInput = [[12, 11, 41], [15, 5, 35]] ## Example 1
+arrInput = [[12, 3, 41], [15, 9, 35], [30, 5, 25]] ## Example 2
+
+## Remarks
+## [Period, Start, Travel Time], [Bus 1], [Bus 2], ...
+
+arrBus = []
+arrOutput = []
+
+for arrLoop in arrInput:
+ nMinStart = arrLoop[1]
+ while nMinStart < 60:
+ arrBus.append([nMinStart, nMinStart + arrLoop[2]])
+ nMinStart = nMinStart + arrLoop[0]
+
+arrBus = sorted(arrBus, key = lambda nElem: (nElem[0], nElem[1]))
+arrBus.append([arrBus[0][0] + 60, arrBus[0][1] + 60])
+
+arrStart = [arrLoop[0] for arrLoop in arrBus]
+
+## print (arrBus)
+
+for nLoop in range(60):
+
+ if nLoop <= arrBus[0][0] or nLoop > arrBus[-2][0]:
+ nIndx = 0
+ else:
+ nIndx = min([nIndx for nIndx, nStartMin in enumerate(arrStart) if nLoop <= nStartMin])
+
+ if arrBus[nIndx][1] <= arrBus[nIndx + 1][1]:
+ continue
+
+ arrOutput.append(nLoop)
+
+print (arrOutput)
diff --git a/challenge-274/ulrich-rieke/cpp/ch-1.cpp b/challenge-274/ulrich-rieke/cpp/ch-1.cpp
new file mode 100755
index 0000000000..2e6743786d
--- /dev/null
+++ b/challenge-274/ulrich-rieke/cpp/ch-1.cpp
@@ -0,0 +1,43 @@
+#include <iostream>
+#include <vector>
+#include <ranges>
+#include <string>
+#include <utility>
+#include <algorithm>
+#include <iterator>
+
+std::string convert( std::pair<int , std::string> & aPair ) {
+ std::string vowels {"AEIOUaeiou"} ;
+ std::string word { aPair.second } ;
+ std::string changed ;
+ if (vowels.find( word.substr( 0 , 1 ) ) != std::string::npos) {
+ changed = word + std::string( "ma" ) ;
+ }
+ else {
+ changed = word.substr( 1 ) + word.substr( 0 , 1 ) + std::string( "ma" ) ;
+ }
+ for ( int i = 0 ; i < aPair.first + 2 ; i++ )
+ changed.append( 1 , 'a' ) ;
+ return changed ;
+}
+
+int main( ) {
+ std::cout << "Enter a sentence!\n" ;
+ std::string line ;
+ std::getline( std::cin , line ) ;
+ auto parts = line | std::views::split( ' ' )
+ | std::views::transform( []( auto&& subrange )
+ { return std::string( subrange.begin( ) , subrange.end( ) ) ; }
+ ) ;
+ std::vector<std::string> words ( parts.begin( ) , parts.end( ) ) ;
+ std::vector<std::pair<int , std::string>> allPairs ;
+ for ( int i = 0 ; i < words.size( ) ; i++ )
+ allPairs.push_back( std::make_pair( i , words[ i ] ) ) ;
+ std::vector<std::string> converted ;
+ for ( auto & pa : allPairs )
+ converted.push_back( convert( pa ) ) ;
+ std::copy( converted.begin( ) , converted.end( ) ,
+ std::ostream_iterator<std::string>( std::cout , " " ) ) ;
+ std::cout << '\n' ;
+ return 0 ;
+}
diff --git a/challenge-274/ulrich-rieke/cpp/ch-2.cpp b/challenge-274/ulrich-rieke/cpp/ch-2.cpp
new file mode 100755
index 0000000000..367d70d308
--- /dev/null
+++ b/challenge-274/ulrich-rieke/cpp/ch-2.cpp
@@ -0,0 +1,90 @@
+#include <iostream>
+#include <algorithm>
+#include <vector>
+#include <iterator>
+#include <string>
+#include <utility>
+
+std::vector<std::string> split( const std::string & startline ,
+ const std::string & sep ) {
+ std::vector<std::string> separated ;
+ std::string::size_type start { 0 } ;
+ std::string::size_type pos ;
+ do {
+ pos = startline.find_first_of( sep , start ) ;
+ separated.push_back( startline.substr(start , pos - start )) ;
+ start = pos + 1 ;
+ } while ( pos != std::string::npos ) ;
+ return separated ;
+}
+
+//given a certain minute, find the next bus departures, sorted by time of
+//departure. Every entry contains the number of the busline and its departure
+std::vector<std::pair<int , int>> findNextDepartures( int minute , const
+ std::vector<std::vector<int>> & schedule ) {
+ int len = schedule.size( ) ;
+ std::vector<std::pair<int , int>> departures ;
+ for ( int i = 0 ; i < len ; i++ ) {
+ int depart = schedule[i][1] ;
+ while ( depart < minute ) {
+ depart += schedule[i][0] ;
+ }
+ departures.push_back( std::make_pair( i , depart )) ;
+ }
+ std::sort( departures.begin( ) , departures.end( ) , []( const auto & p1 ,
+ const auto & p2 ) { return p1.second < p2.second ; } ) ;
+ return departures ;
+}
+//find the arrival times of the buses in the order of their start
+std::vector<int> findArrivals( const std::vector<std::vector<int>> & schedule ,
+ const std::vector<std::pair<int , int>> & departures ) {
+ std::vector<int> arrivals ;
+ for ( auto it = departures.begin( ) ; it != departures.end( ) ; ++it ) {
+ int arri = it->second + schedule[it->first][2] ;
+ arrivals.push_back( arri ) ;
+ }
+ return arrivals ;
+}
+//at a given minute , should I let a bus pass ? yes, if the second bus arrives
+//strictly sooner, provided 2 buses don't leave at the same time and don't
+//arrive at the same time
+bool let_pass_one( int minute , const std::vector<std::vector<int>> & schedule ) {
+ std::vector<std::pair<int , int>> next_departures = findNextDepartures(
+ minute , schedule ) ;
+ std::vector<int> arrivals = findArrivals( schedule , next_departures ) ;
+ if ( (next_departures[0].second != next_departures[1].second) && (arrivals[0]
+ > arrivals[1] ) )
+ return true ;
+ else
+ return false ;
+}
+
+int main( ) {
+ std::cout << "Please enter some bus schedules ( 3 numbers per line ) !\n" ;
+ std::cout << "Enter <return> to end!\n" ;
+ std::string line ;
+ std::vector<std::string> allLines ;
+ std::getline( std::cin , line ) ;
+ while ( line.length( ) > 0 ) {
+ allLines.push_back( line ) ;
+ std::getline( std::cin , line ) ;
+ }
+ std::vector<std::vector<int>> schedule ;
+ for ( auto & l : allLines ) {
+ std::vector<std::string> aLine { split( l , " " ) } ;
+ std::vector<int> numbers ;
+ for ( auto & w : aLine )
+ numbers.push_back( std::stoi( w ) ) ;
+ schedule.push_back( numbers ) ;
+ }
+ std::vector<int> result ;
+ for ( int i = 0 ; i < 60 ; i++ ) {
+ if ( let_pass_one( i , schedule ) )
+ result.push_back( i ) ;
+ }
+ std::cout << "[ " ;
+ std::copy( result.begin( ) , result.end( ) , std::ostream_iterator<int>(
+ std::cout , " " ) ) ;
+ std::cout << "]\n" ;
+ return 0 ;
+}
diff --git a/challenge-274/ulrich-rieke/haskell/ch-1.hs b/challenge-274/ulrich-rieke/haskell/ch-1.hs
new file mode 100755
index 0000000000..593ec280ed
--- /dev/null
+++ b/challenge-274/ulrich-rieke/haskell/ch-1.hs
@@ -0,0 +1,17 @@
+module Challenge274
+ where
+import Data.List ( tail )
+
+vowels :: [Char]
+vowels = "AEIOUaeiou"
+
+convert :: String -> Int -> String
+convert s pos = if elem ( head s ) vowels then s ++ "ma" ++ replicate ( pos + 1 ) 'a'
+ else tail s ++ [head s] ++ "ma" ++ replicate ( pos + 1 ) 'a'
+
+main :: IO ( )
+main = do
+ putStrLn "Enter a string!"
+ line <- getLine
+ let zipped = zip ( words line ) [0 , 1 ..]
+ print $ unwords $ map (\(word, p) -> convert word p ) zipped
diff --git a/challenge-274/ulrich-rieke/haskell/ch-2.hs b/challenge-274/ulrich-rieke/haskell/ch-2.hs
new file mode 100755
index 0000000000..92f3fb7824
--- /dev/null
+++ b/challenge-274/ulrich-rieke/haskell/ch-2.hs
@@ -0,0 +1,51 @@
+module Challenge274_2
+ where
+import Data.List ( (!!) , sortOn)
+
+--when does the next bus line leave ?
+findNextStart :: Int -> [Int] -> Int
+findNextStart minute busschedule = head $ dropWhile ( < minute ) $
+ iterate ( + busschedule !! 0 ) (busschedule !! 1 )
+
+--which lines come next , in order of start
+nextStarts :: Int -> [[Int]] -> [(Int , Int)]
+nextStarts minute schedule = sortOn snd $ map (\(i , sched ) -> (i ,
+ findNextStart minute sched )) $ zip [0 , 1 ..] schedule
+
+--when do the next buses arrive, in order of start ?
+findArrivals :: Int -> [[Int]] -> [Int]
+findArrivals minute schedule =
+ let starts = nextStarts minute schedule
+ in map (\( i , d ) -> d + schedule !! i !! 2 ) starts
+
+--let one bus leave if the first bus arrives in town later ,
+--provided they do not start at the same time and arrive at the
+--same time
+letOnePass :: Int -> [[Int]] -> Bool
+letOnePass minute schedule =
+ let starts = nextStarts minute schedule
+ firstLines = ( snd $ starts !! 0 , snd $ starts !! 1 )
+ arrivals = map (\(i , d) -> d + schedule !! i !! 2 ) starts
+ in (fst firstLines /= snd firstLines) && ( minimum arrivals == arrivals
+ !! 1 ) && ( arrivals !! 0 /= arrivals !! 1 )
+
+enterNLines :: Int -> IO [String]
+enterNLines n
+ |n <= 0 = return []
+ |otherwise = do
+ putStrLn "Enter some integers, separated by blanks!"
+ x <- getLine
+ xs <- enterNLines ( n - 1 )
+ let ret = (x:xs)
+ return ret
+
+solution :: [[Int]] -> [Int]
+solution schedule = filter (\i -> letOnePass i schedule ) [0..59]
+
+main = do
+ putStrLn "Enter some bus schedules!( interval , offset , drive time! )"
+ putStrLn "For how many bus lines do you want to enter schedules ?"
+ linenumber <- getLine
+ buslines <- enterNLines ( read linenumber )
+ let schedule = map ( map read . words ) buslines
+ print $ solution schedule
diff --git a/challenge-274/ulrich-rieke/perl/ch-1.pl b/challenge-274/ulrich-rieke/perl/ch-1.pl
new file mode 100755
index 0000000000..9251c64db8
--- /dev/null
+++ b/challenge-274/ulrich-rieke/perl/ch-1.pl
@@ -0,0 +1,28 @@
+#!/usr/bin/perl ;
+use strict ;
+use warnings ;
+use feature 'say' ;
+
+sub convert {
+ my $pair = shift ;
+ my $word = $pair->[1] ;
+ if ( $word =~ /^[AEIOUaeiou]/ ) {
+ $word .= "ma" ;
+ }
+ else {
+ $word = ( substr( $word , 1 ) . substr( $word , 0 , 1 ) . "ma" ) ;
+ }
+ $word .= "a" x ( $pair->[0] + 1 ) ;
+ return $word ;
+}
+
+say "Enter a sentence!" ;
+my $line = <STDIN> ;
+chomp $line ;
+my @words = split( /\s+/ , $line ) ;
+my @wordIndices ;
+for my $i (0.. scalar( @words ) - 1 ) {
+ push( @wordIndices, [$i , $words[$i]] ) ;
+}
+my @result = map { convert( $_ ) } @wordIndices ;
+say join( ' ' , @result) ;
diff --git a/challenge-274/ulrich-rieke/perl/ch-2.pl b/challenge-274/ulrich-rieke/perl/ch-2.pl
new file mode 100755
index 0000000000..7fa34a87fe
--- /dev/null
+++ b/challenge-274/ulrich-rieke/perl/ch-2.pl
@@ -0,0 +1,72 @@
+#!/usr/bin/perl ;
+use strict ;
+use warnings ;
+use feature 'say' ;
+use List::Util qw ( min ) ;
+
+#given a minute and the array of bus schedules , find an array that orders
+#the bus lines by proximity to the given minute, storing the number of the
+#bus line first
+sub findNextStarts {
+ my $number = shift ;
+ my $schedule = shift ;
+ my @startList ;
+ for my $i (0..scalar( @$schedule ) - 1) {
+ my $start = $schedule->[$i]->[1] ;
+ while ( $start < $number ) {
+ $start += $schedule->[$i]->[0] ;
+ }
+ push ( @startList , [$i , $start] ) ;
+ }
+ my @sorted = sort { $a->[1] <=> $b->[1] } @startList ;
+ return @sorted ;
+}
+#find the arrival times in the order of the start times
+sub findNextArrivals {
+ my $number = shift ; #the minute
+ my $schedule = shift ; #the bus line schedule
+ my $startList = shift ; #the array of [bus line number , start time]
+ my @arrivals ; #times of arrival in the city
+ for my $st ( @$startList ) {
+ push( @arrivals , $st->[1] + $schedule->[$st->[0]]->[2] ) ;
+ }
+ return @arrivals ;
+}
+#we have to let 1 bus pass if the next bus arrives strictly earlier ,
+#provided the no two buses start or arrive at the same time
+sub myCondition {
+ my $number = shift ;
+ my $schedule = shift ;
+ my @nextStarts = findNextStarts( $number , $schedule ) ;
+ my @arrivals = findNextArrivals( $number , $schedule , \@nextStarts ) ;
+ if ( ($nextStarts[ 0 ]->[1] != $nextStarts[1]->[1]) && ($arrivals[0] !=
+ $arrivals[1] ) && ( min( @arrivals ) == $arrivals[ 1 ] ) ) {
+ return 1 ;
+ }
+ else {
+ return 0 ;
+ }
+}
+
+say "Enter the schedule of some bus lines in 3 numbers each!" ;
+my @lines ;
+my $line = <STDIN> ;
+chomp $line ;
+while ( $line ) {
+ push @lines , $line ;
+ say "Next bus line !" ;
+ $line = <STDIN> ;
+ chomp $line ;
+}
+my @times ;
+for my $inline ( @lines ) {
+ my @schedule = split ( /\s+/ , $inline ) ;
+ push ( @times , \@schedule ) ;
+}
+my @selected = grep { myCondition( $_ , \@times ) } (0..59) ;
+if ( @selected ) {
+ say "[" . join( ',' , @selected) . "]" ;
+}
+else {
+ say "[]" ;
+}
diff --git a/challenge-274/ulrich-rieke/raku/ch-1.raku b/challenge-274/ulrich-rieke/raku/ch-1.raku
new file mode 100755
index 0000000000..6677e42b80
--- /dev/null
+++ b/challenge-274/ulrich-rieke/raku/ch-1.raku
@@ -0,0 +1,24 @@
+use v6 ;
+
+sub convert( ($index , $word is copy) ) {
+ my $vowels = ('A' , 'E' , 'I' , 'O' , 'U' , 'a' , 'e' , 'i' , 'o' , 'u').Set ;
+ my $firstLetter = ($word.comb)[0] ;
+ if ( $firstLetter (elem) $vowels ) {
+ $word ~= "ma" ;
+ }
+ else {
+ $word = ($word.substr( 1 ) ~ $firstLetter.Str ~ "ma" ) ;
+ }
+ $word ~= 'a' x ( $index + 1 ) ;
+ return $word ;
+}
+
+say "Enter a sentence!" ;
+my $line = $*IN.get ;
+my @words = $line.words ;
+my @word_indices ;
+for (0..@words.elems - 1 ) -> $pos {
+ @word_indices.push( ($pos , @words[ $pos ] ) ) ;
+}
+my @converted = @word_indices.map( { convert( $_ ) } ) ;
+say @converted.join( ' ' ) ;
diff --git a/challenge-274/ulrich-rieke/raku/ch-2.raku b/challenge-274/ulrich-rieke/raku/ch-2.raku
new file mode 100755
index 0000000000..bfb2fc4ced
--- /dev/null
+++ b/challenge-274/ulrich-rieke/raku/ch-2.raku
@@ -0,0 +1,50 @@
+use v6 ;
+
+sub findNextStarts( $number , @schedule ) {
+ my @startList ;
+ for (0..@schedule.elems - 1) -> $i {
+ my $start = @schedule[$i][1] ;
+ while ( $start < $number ) {
+ $start += @schedule[$i][0] ;
+ }
+ @startList.push( ($i , $start ) ) ;
+ }
+ my @sorted = @startList.sort( {$^a[1] <=> $^b[1]} ) ;
+ return @sorted ;
+}
+
+sub findNextArrivals( @schedule , @departures ) {
+ my @arrivals ;
+ for ( @departures ) -> $pair {
+ @arrivals.push( $pair[1] + @schedule[$pair[0]][2] ) ;
+ }
+ return @arrivals ;
+}
+
+sub myCondition( $minute , @schedule ) {
+ my @nextStarts = findNextStarts( $minute , @schedule ) ;
+ my @arrivals = findNextArrivals( @schedule , @nextStarts ) ;
+ if ( @nextStarts[0][1] != @nextStarts[1][1] && @arrivals[0] > @arrivals[1] ) {
+ return True ;
+ }
+ else {
+ return False ;
+ }
+}
+
+say "Enter the schedule of some bus lines in 3 numbers each!" ;
+my @lines ;
+my $line = $*IN.get ;
+while ( $line ) {
+ @lines.push( $line ) ;
+ $line = $*IN.get ;
+}
+my @schedule ;
+for @lines -> $bus {
+ my @subschedule = $bus.words.map( {.Int} ) ;
+ @schedule.push( @subschedule ) ;
+}
+my @selected = (0..59).grep( {myCondition( $_ , @schedule )} ) ;
+print '[' ;
+print @selected.join( ',' ) ;
+say ']' ;
diff --git a/challenge-274/ulrich-rieke/rust/ch-1.rs b/challenge-274/ulrich-rieke/rust/ch-1.rs
new file mode 100755
index 0000000000..4f1f8f5cc0
--- /dev/null
+++ b/challenge-274/ulrich-rieke/rust/ch-1.rs
@@ -0,0 +1,45 @@
+use std::io ;
+
+fn convert( element : (usize , &str) ) -> String {
+ let vowels : Vec<char> = vec!['A' , 'E' , 'I' , 'O' , 'U' , 'a' , 'e' , 'i' ,
+ 'o' , 'u'] ;
+ let vows = &vowels[..] ;
+ let word : &str = element.1 ;
+ let first_letter : char = word.chars( ).nth( 0 ).unwrap( ) ;
+ let mut changed : String = String::new( ) ;
+ if vows.contains( &first_letter ) {
+ for c in word.chars( ) {
+ changed.push( c ) ;
+ }
+ }
+ else {
+ for c in word.chars( ).skip( 1 ) {
+ changed.push( c ) ;
+ }
+ changed.push( first_letter ) ;
+ }
+ changed.push_str( "ma" ) ;
+ let added : String = "a".repeat( element.0 + 1 ) ;
+ changed.push_str( &added ) ;
+ changed
+}
+
+fn main() {
+ println!("Enter a sentence!");
+ let mut inline : String = String::new( ) ;
+ io::stdin( ).read_line( &mut inline ).unwrap( ) ;
+ let entered_line : &str = inline.as_str( ).trim( ) ;
+ let words : Vec<&str> = entered_line.split_whitespace( ).collect( ) ;
+ let mut goated : Vec<String> = Vec::new( ) ;
+ words.into_iter( ).enumerate( ).for_each( | p | goated.push( convert( p ) ) ) ;
+ let mut final_string : String = String::new( ) ;
+ final_string.push_str( goated[0].as_str( ) ) ;
+ final_string.push_str( " " ) ;
+ for i in 1..goated.len( ) {
+ final_string.push_str( &goated[i] ) ;
+ if i < goated.len( ) - 1 {
+ final_string.push_str( " " ) ;
+ }
+ }
+ println!( "{:?}" , final_string) ;
+}
diff --git a/challenge-274/ulrich-rieke/rust/ch-2.rs b/challenge-274/ulrich-rieke/rust/ch-2.rs
new file mode 100755
index 0000000000..351d20f027
--- /dev/null
+++ b/challenge-274/ulrich-rieke/rust/ch-2.rs
@@ -0,0 +1,68 @@
+use std::io ;
+use std::io::BufRead ;
+
+fn find_next_departures( minute : u8 , schedule : &Vec<Vec<u8>> ) -> Vec<(u8 , u8)> {
+ let mut dep_pairs : Vec<(u8 , u8)> = Vec::new( ) ;
+ let len = schedule.len( ) ;
+ for i in 0..len {
+ let mut dep : u8 = schedule[i][1] ;
+ while dep < minute {
+ dep += schedule[i][0] ;
+ }
+ dep_pairs.push( (i as u8 , dep) ) ;
+ }
+ let pairs = &mut dep_pairs[..] ;
+ pairs.sort_by( | a , b | a.1.partial_cmp( &b.1).unwrap( ) ) ;
+ let result : Vec<(u8 , u8)> = pairs.to_vec( ) ;
+ result
+}
+
+fn find_arrivals( schedule : &Vec<Vec<u8>> , next_buses : &Vec<(u8,u8)>)
+ -> Vec<u8> {
+ let mut arrivals : Vec<u8> = Vec::new( ) ;
+ for pair in next_buses {
+ let arri : u8 = pair.1 + schedule[pair.0 as usize][2] ;
+ arrivals.push( arri ) ;
+ }
+ arrivals
+}
+
+fn let_pass_one( minute : u8 , schedule : &Vec<Vec<u8>> ) -> bool {
+ let next_departures : Vec<(u8 , u8)> = find_next_departures( minute , &schedule ) ;
+ let arrivals : Vec<u8> = find_arrivals( &schedule , &next_departures ) ;
+ if next_departures[0].1 != next_departures[1].1 && arrivals[0] > arrivals[1] {
+ return true ;
+ }
+ false
+}
+
+fn main() -> io::Result<()> {
+ println!("Enter some lines of 3 digits marking interval, start and travel time!") ;
+ println!( "Enter <return> to end!" ) ;
+ let mut lines = io::stdin( ).lock( ).lines( ) ;
+ let mut all_input : String = String::new( ) ;
+ while let Some( line ) = lines.next( ) {
+ let last_input = line.unwrap( ) ;
+ if last_input.len( ) == 0 {
+ break ;
+ }
+ else {
+ all_input.push_str( &last_input ) ;
+ all_input.push_str( "\n" ) ;
+ }
+ }
+ let all_lines : &str = all_input.as_str( ).trim( ) ;
+ let rows : Vec<&str> = all_lines.split( "\n" ).collect( ) ;
+ let mut schedule : Vec<Vec<u8>> = Vec::new( ) ;
+ for r in &rows {
+ if r.len( ) > 0 {
+ let sub_schedule : Vec<u8> = r.split_whitespace( ).map( | s |
+ s.trim( ).parse::<u8>( ).unwrap( ) ).collect( ) ;
+ schedule.push( sub_schedule ) ;
+ }
+ }
+ let result : Vec<u8> = (0..60).filter( | &i | let_pass_one( i , &schedule ) ).
+ collect( ) ;
+ println!("{:?}" , result) ;
+ Ok(())
+}
diff --git a/stats/pwc-challenge-273.json b/stats/pwc-challenge-273.json
new file mode 100644
index 0000000000..18c95adf4d
--- /dev/null
+++ b/stats/pwc-challenge-273.json
@@ -0,0 +1,722 @@
+{
+ "series" : [
+ {
+ "colorByPoint" : 1,
+ "data" : [
+ {
+ "y" : 4,
+ "drilldown" : "Ali Moradi",
+ "name" : "Ali Moradi"
+ },
+ {
+ "name" : "Andrew Schneider",
+ "y" : 3,
+ "drilldown" : "Andrew Schneider"
+ },
+ {
+ "drilldown" : "Andrew Shitov",
+ "y" : 2,
+ "name" : "Andrew Shitov"
+ },
+ {
+ "name" : "Arne Sommer",
+ "drilldown" : "Arne Sommer",
+ "y" : 3
+ },
+ {
+ "y" : 4,
+ "drilldown" : "Athanasius",
+ "name" : "Athanasius"
+ },
+ {
+ "name" : "BarrOff",
+ "drilldown" : "BarrOff",
+ "y" : 3
+ },
+ {
+ "y" : 2,
+ "drilldown" : "Bob Lied",
+ "name" : "Bob Lied"
+ },
+ {
+ "y" : 4,
+ "drilldown" : "Bruce Gray",
+ "name" : "Bruce Gray"
+ },
+ {
+ "name" : "Cheok-Yin Fung",
+ "y" : 2,
+ "drilldown" : "Cheok-Yin Fung"
+ },
+ {
+ "name" : "Dave Jacoby",
+ "drilldown" : "Dave Jacoby",
+ "y" : 3
+ },
+ {
+ "y" : 2,
+ "drilldown" : "David Ferrone",
+ "name" : "David Ferrone"
+ },
+ {
+ "name" : "E. Choroba",
+ "drilldown" : "E. Choroba",
+ "y" : 2
+ },
+ {
+ "name" : "Ian Goodnight",
+ "drilldown" : "Ian Goodnight",
+ "y" : 2
+ },
+ {
+ "y" : 5,
+ "drilldown" : "Jaldhar H. Vyas",
+ "name" : "Jaldhar H. Vyas"
+ },
+ {
+ "drilldown" : "Jan Krnavek",
+ "y" : 2,
+ "name" : "Jan Krnavek"
+ },
+ {
+ "y" : 4,
+ "drilldown" : "Joelle Maslak",
+ "name" : "Joelle Maslak"
+ },
+ {
+ "drilldown" : "Jorg Sommrey",
+ "y" : 3,
+ "name" : "Jorg Sommrey"
+ },
+ {
+ "name" : "Laurent Rosenfeld",
+ "drilldown" : "Laurent Rosenfeld",
+ "y" : 6
+ },
+ {
+ "name" : "Luca Ferrari",
+ "drilldown" : "Luca Ferrari",
+ "y" : 11
+ },
+ {
+ "name" : "Mariano Spadaccini",
+ "drilldown" : "Mariano Spadaccini",
+ "y" : 2
+ },
+ {
+ "y" : 2,
+ "drilldown" : "Mark Anderson",
+ "name" : "Mark Anderson"
+ },
+ {
+ "name" : "Matthew Neleigh",
+ "y" : 2,
+ "drilldown" : "Matthew Neleigh"
+ },
+ {
+ "name" : "Matthias Muth",
+ "drilldown" : "Matthias Muth",
+ "y" : 3
+ },
+ {
+ "name" : "Nelo Tovar",
+ "drilldown" : "Nelo Tovar",
+ "y" : 2
+ },
+ {
+ "drilldown" : "Niels van Dijke",
+ "y" : 2,
+ "name" : "Niels van Dijke"
+ },
+ {
+ "name" : "Packy Anderson",
+ "drilldown" : "Packy Anderson",
+ "y" : 5
+ },
+ {
+ "name" : "Peter Campbell Smith",
+ "drilldown" : "Peter Campbell Smith",
+ "y" : 3
+ },
+ {
+ "y" : 2,
+ "drilldown" : "Peter Meszaros",
+ "name" : "Peter Meszaros"
+ },
+ {
+ "drilldown" : "Reinier Maliepaard",
+ "y" : 3,
+ "name" : "Reinier Maliepaard"
+ },
+ {
+ "name" : "Robbie Hatley",
+ "drilldown" : "Robbie Hatley",
+ "y" : 3
+ },
+ {
+ "drilldown" : "Robert DiCicco",
+ "y" : 1,
+ "name" : "Robert DiCicco"
+ },
+ {
+ "name" : "Robert Ransbottom",
+ "drilldown" : "Robert Ransbottom",
+ "y" : 2
+ },
+ {
+ "y" : 5,
+ "drilldown" : "Roger Bell_West",
+ "name" : "Roger Bell_West"
+ },
+ {
+ "name" : "Simon Green",
+ "y" : 3,
+ "drilldown" : "Simon Green"
+ },
+ {
+ "name" : "Thomas Kohler",
+ "y" : 4,
+ "drilldown" : "Thomas Kohler"
+ },
+ {
+ "drilldown" : "Ulrich Rieke",
+ "y" : 4,
+ "name" : "Ulrich Rieke"
+ },
+ {
+ "name" : "W. Luis Mochan",
+ "drilldown" : "W. Luis Mochan",
+ "y" : 3
+ },
+ {