aboutsummaryrefslogtreecommitdiff
path: root/challenge-001/mfoda/nim/ch1.nim
blob: e7a7eb721a2462a168bae4afa840954cc34a297f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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]"