aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-01-13 05:53:46 +0000
committerGitHub <noreply@github.com>2021-01-13 05:53:46 +0000
commit664d2f45607ef860426754a1efc524d0580cf5dc (patch)
tree21a2e3f59bfc5fde6c0125abfb18e0a2f320dd01
parent3d6d1a6bcb4d58dac5c09abb0c4f5bc42f0fa944 (diff)
parent15e394ba428c287eb6619018af86770db1db4819 (diff)
downloadperlweeklychallenge-club-664d2f45607ef860426754a1efc524d0580cf5dc.tar.gz
perlweeklychallenge-club-664d2f45607ef860426754a1efc524d0580cf5dc.tar.bz2
perlweeklychallenge-club-664d2f45607ef860426754a1efc524d0580cf5dc.zip
Merge pull request #3242 from mfoda/mfoda-002-nim
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