aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormfoda <23182653+mfoda@users.noreply.github.com>2021-01-13 13:17:18 +0800
committermfoda <23182653+mfoda@users.noreply.github.com>2021-01-13 13:17:18 +0800
commit15e394ba428c287eb6619018af86770db1db4819 (patch)
tree21a2e3f59bfc5fde6c0125abfb18e0a2f320dd01
parent3d6d1a6bcb4d58dac5c09abb0c4f5bc42f0fa944 (diff)
downloadperlweeklychallenge-club-15e394ba428c287eb6619018af86770db1db4819.tar.gz
perlweeklychallenge-club-15e394ba428c287eb6619018af86770db1db4819.tar.bz2
perlweeklychallenge-club-15e394ba428c287eb6619018af86770db1db4819.zip
Add ch-1 in nim
-rw-r--r--challenge-001/mfoda/README1
-rw-r--r--challenge-001/mfoda/nim/ch1.nim13
2 files changed, 14 insertions, 0 deletions
diff --git a/challenge-001/mfoda/README b/challenge-001/mfoda/README
new file mode 100644
index 0000000000..3aefec5aa9
--- /dev/null
+++ b/challenge-001/mfoda/README
@@ -0,0 +1 @@
+Solution by mfoda
diff --git a/challenge-001/mfoda/nim/ch1.nim b/challenge-001/mfoda/nim/ch1.nim
new file mode 100644
index 0000000000..e7a7eb721a
--- /dev/null
+++ b/challenge-001/mfoda/nim/ch1.nim
@@ -0,0 +1,13 @@
+#[
+ Write a script to replace the character ‘e’ with ‘E’ in the string ‘Perl Weekly Challenge’.
+ Also print the number of times the character ‘e’ is found in the string.
+]#
+
+import strutils, strformat
+
+let
+ input = "Perl Weekly Challenge"
+ countE= input.count("e")
+ replaced = input.replace("e", "E")
+
+echo &"'{replaced}' [{countE} replaced]" \ No newline at end of file