diff options
| -rw-r--r-- | challenge-001/mfoda/README | 1 | ||||
| -rw-r--r-- | challenge-001/mfoda/nim/ch1.nim | 13 |
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 |
