aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-018/zapwai/c/ch-1.c46
-rw-r--r--challenge-018/zapwai/javascript/ch-1.js46
-rw-r--r--challenge-018/zapwai/perl/ch-1.pl46
-rw-r--r--challenge-018/zapwai/python/ch-1.py46
-rw-r--r--challenge-018/zapwai/rust/ch-1.rs46
5 files changed, 0 insertions, 230 deletions
diff --git a/challenge-018/zapwai/c/ch-1.c b/challenge-018/zapwai/c/ch-1.c
deleted file mode 100644
index d9aa2d1a54..0000000000
--- a/challenge-018/zapwai/c/ch-1.c
+++ /dev/null
@@ -1,46 +0,0 @@
-use v5.38;
-if (@ARGV < 2) {
- say "Please provide two (or more) arguments.";
- exit;
-}
-
-sub gen_substr($word) {
- my @subs;
- my $current_length = 1;
- my $a = -1;
- do {
- $a++;
- if ($a + $current_length > length $word) {
- $a = 0;
- $current_length++;
- }
- push @subs, substr($word, $a, $current_length);
- } while ($current_length < length $word);
- return @subs;
-}
-
-sub common(@list) {
- my $ans;
- my @subs;
- for my $i (0 .. $#list) {
- push @subs, gen_substr($list[$i]);
- }
- my @common;
- for my $i (0 .. $#subs) {
- for my $j (0 .. $#subs) {
- next if ($i == $j);
- push @common, $subs[$i] if ($subs[$i] eq $subs[$j]);
- }
- }
- my $max = 0;
- my $ans_word;
- for my $word (@common) {
- if (length $word > $max) {
- $max = length $word;
- $ans_word = $word;
- }
- }
- return $ans_word;
-}
-
-say common(@ARGV);
diff --git a/challenge-018/zapwai/javascript/ch-1.js b/challenge-018/zapwai/javascript/ch-1.js
deleted file mode 100644
index d9aa2d1a54..0000000000
--- a/challenge-018/zapwai/javascript/ch-1.js
+++ /dev/null
@@ -1,46 +0,0 @@
-use v5.38;
-if (@ARGV < 2) {
- say "Please provide two (or more) arguments.";
- exit;
-}
-
-sub gen_substr($word) {
- my @subs;
- my $current_length = 1;
- my $a = -1;
- do {
- $a++;
- if ($a + $current_length > length $word) {
- $a = 0;
- $current_length++;
- }
- push @subs, substr($word, $a, $current_length);
- } while ($current_length < length $word);
- return @subs;
-}
-
-sub common(@list) {
- my $ans;
- my @subs;
- for my $i (0 .. $#list) {
- push @subs, gen_substr($list[$i]);
- }
- my @common;
- for my $i (0 .. $#subs) {
- for my $j (0 .. $#subs) {
- next if ($i == $j);
- push @common, $subs[$i] if ($subs[$i] eq $subs[$j]);
- }
- }
- my $max = 0;
- my $ans_word;
- for my $word (@common) {
- if (length $word > $max) {
- $max = length $word;
- $ans_word = $word;
- }
- }
- return $ans_word;
-}
-
-say common(@ARGV);
diff --git a/challenge-018/zapwai/perl/ch-1.pl b/challenge-018/zapwai/perl/ch-1.pl
deleted file mode 100644
index d9aa2d1a54..0000000000
--- a/challenge-018/zapwai/perl/ch-1.pl
+++ /dev/null
@@ -1,46 +0,0 @@
-use v5.38;
-if (@ARGV < 2) {
- say "Please provide two (or more) arguments.";
- exit;
-}
-
-sub gen_substr($word) {
- my @subs;
- my $current_length = 1;
- my $a = -1;
- do {
- $a++;
- if ($a + $current_length > length $word) {
- $a = 0;
- $current_length++;
- }
- push @subs, substr($word, $a, $current_length);
- } while ($current_length < length $word);
- return @subs;
-}
-
-sub common(@list) {
- my $ans;
- my @subs;
- for my $i (0 .. $#list) {
- push @subs, gen_substr($list[$i]);
- }
- my @common;
- for my $i (0 .. $#subs) {
- for my $j (0 .. $#subs) {
- next if ($i == $j);
- push @common, $subs[$i] if ($subs[$i] eq $subs[$j]);
- }
- }
- my $max = 0;
- my $ans_word;
- for my $word (@common) {
- if (length $word > $max) {
- $max = length $word;
- $ans_word = $word;
- }
- }
- return $ans_word;
-}
-
-say common(@ARGV);
diff --git a/challenge-018/zapwai/python/ch-1.py b/challenge-018/zapwai/python/ch-1.py
deleted file mode 100644
index d9aa2d1a54..0000000000
--- a/challenge-018/zapwai/python/ch-1.py
+++ /dev/null
@@ -1,46 +0,0 @@
-use v5.38;
-if (@ARGV < 2) {
- say "Please provide two (or more) arguments.";
- exit;
-}
-
-sub gen_substr($word) {
- my @subs;
- my $current_length = 1;
- my $a = -1;
- do {
- $a++;
- if ($a + $current_length > length $word) {
- $a = 0;
- $current_length++;
- }
- push @subs, substr($word, $a, $current_length);
- } while ($current_length < length $word);
- return @subs;
-}
-
-sub common(@list) {
- my $ans;
- my @subs;
- for my $i (0 .. $#list) {
- push @subs, gen_substr($list[$i]);
- }
- my @common;
- for my $i (0 .. $#subs) {
- for my $j (0 .. $#subs) {
- next if ($i == $j);
- push @common, $subs[$i] if ($subs[$i] eq $subs[$j]);
- }
- }
- my $max = 0;
- my $ans_word;
- for my $word (@common) {
- if (length $word > $max) {
- $max = length $word;
- $ans_word = $word;
- }
- }
- return $ans_word;
-}
-
-say common(@ARGV);
diff --git a/challenge-018/zapwai/rust/ch-1.rs b/challenge-018/zapwai/rust/ch-1.rs
deleted file mode 100644
index d9aa2d1a54..0000000000
--- a/challenge-018/zapwai/rust/ch-1.rs
+++ /dev/null
@@ -1,46 +0,0 @@
-use v5.38;
-if (@ARGV < 2) {
- say "Please provide two (or more) arguments.";
- exit;
-}
-
-sub gen_substr($word) {
- my @subs;
- my $current_length = 1;
- my $a = -1;
- do {
- $a++;
- if ($a + $current_length > length $word) {
- $a = 0;
- $current_length++;
- }
- push @subs, substr($word, $a, $current_length);
- } while ($current_length < length $word);
- return @subs;
-}
-
-sub common(@list) {
- my $ans;
- my @subs;
- for my $i (0 .. $#list) {
- push @subs, gen_substr($list[$i]);
- }
- my @common;
- for my $i (0 .. $#subs) {
- for my $j (0 .. $#subs) {
- next if ($i == $j);
- push @common, $subs[$i] if ($subs[$i] eq $subs[$j]);
- }
- }
- my $max = 0;
- my $ans_word;
- for my $word (@common) {
- if (length $word > $max) {
- $max = length $word;
- $ans_word = $word;
- }
- }
- return $ans_word;
-}
-
-say common(@ARGV);