aboutsummaryrefslogtreecommitdiff
path: root/challenge-001/abigail/tcl/ch-1.tcl
blob: 6597b18b52ef026c0b55801b9cfcab0961688f38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/local/opt/tcl-tk/bin/tclsh

#
# See https://theweeklychallenge.org/blog/perl-weekly-challenge-001
#

#
# Run as: tclsh ch-1.tcl < input-file
#

while {[gets stdin line] >= 0} {
    set count 0
    set index [string first e $line]
    while {$index >= 0} {
        incr count
        set line [string replace $line $index $index E]
        set index [string first e $line]
    }
    puts $line
    puts $count
}