Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
14
Task/Text-processing-2/Sidef/text-processing-2.sidef
Normal file
14
Task/Text-processing-2/Sidef/text-processing-2.sidef
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
var good_records = 0;
|
||||
var dates = Hash();
|
||||
|
||||
ARGF.each { |line|
|
||||
var m = /^(\d\d\d\d-\d\d-\d\d)((?:\h+\d+\.\d+\h+-?\d+){24})\s*$/.match(line);
|
||||
m || (warn "Bad format at line #{$.}"; next);
|
||||
dates{m[0]} := 0 ++;
|
||||
var i = 0;
|
||||
m[1].words.all{|n| i++.is_even || (n.to_num >= 1) } && ++good_records;
|
||||
}
|
||||
|
||||
say "#{good_records} good records out of #{$.} total";
|
||||
say 'Repeated timestamps:';
|
||||
say dates.to_a.grep{ .value > 1 }.map { .key }.sort.join("\n");
|
||||
Loading…
Add table
Add a link
Reference in a new issue