var line1, line2, before, after : string
var StreamNum1, StreamNum2, junkfound1, junkfound2, space2, space3, space4 : int
open : StreamNum1, "junkfood.txt", get
if StreamNum1 < 0 then
put "File Access error: 404 or file not readable"
else
open : StreamNum2, "junkfoodfixed.txt", put
loop
exit when eof (StreamNum1)
get : StreamNum1, line1 : *
junkfound1 := index (line1, "Junk Food")
junkfound2 := index (line1, "junk food")
if junkfound1 > 0 then
before := line1 (1 .. junkfound1 - 1)
line2 := "Unhealthy Treats"
after := line1 (junkfound1 + 9 .. *)
line1 := before + line2 + after
elsif junkfound2 > 0 then
before := line1 (1 .. junkfound2 - 1)
line2 := "unhealthy treats"
after := line1 (junkfound2 + 9 .. *)
line1 := before + line2 + after
end if
put : StreamNum2, line1
end loop
close : StreamNum1
close : StreamNum2
end if
open : StreamNum1, "junkfoodfixed.txt", get
if StreamNum1 < 0 then
put "File Access error: 404 or file not readable"
else
open : StreamNum2, "junkfoodfixed2.txt", put
loop
exit when eof (StreamNum1)
get : StreamNum1, line1 : *
space4 := index (line1, " ")
space3 := index (line1, " ")
space2 := index (line1, " ")
if space4 > 0 then
before := line1 (1 .. space4)
after := line1 (space4 + 3 .. *)
line1 := before + after
end if
if space3 > 0 then
before := line1 (1 .. space3)
after := line1 (space3 + 2 .. *)
line1 := before + after
end if
if space2 > 0 then
before := line1 (1 .. space2)
after := line1 (space2 + 1 .. *)
line1 := before + after
end if
put line1
put : StreamNum2, line1
end loop
close : StreamNum1
close : StreamNum2
end if
dmFyIGxpbmUxLCBsaW5lMiwgYmVmb3JlLCBhZnRlciA6IHN0cmluZwp2YXIgU3RyZWFtTnVtMSwgU3RyZWFtTnVtMiwganVua2ZvdW5kMSwganVua2ZvdW5kMiwgc3BhY2UyLCBzcGFjZTMsIHNwYWNlNCA6IGludAoKb3BlbiA6IFN0cmVhbU51bTEsICJqdW5rZm9vZC50eHQiLCBnZXQKCmlmIFN0cmVhbU51bTEgPCAwIHRoZW4KICAgIHB1dCAiRmlsZSBBY2Nlc3MgZXJyb3I6IDQwNCBvciBmaWxlIG5vdCByZWFkYWJsZSIKZWxzZQogICAgb3BlbiA6IFN0cmVhbU51bTIsICJqdW5rZm9vZGZpeGVkLnR4dCIsIHB1dAogICAgbG9vcAogICAgICAgIGV4aXQgd2hlbiBlb2YgKFN0cmVhbU51bTEpCiAgICAgICAgZ2V0IDogU3RyZWFtTnVtMSwgbGluZTEgOiAqCiAgICAgICAganVua2ZvdW5kMSA6PSBpbmRleCAobGluZTEsICJKdW5rIEZvb2QiKQogICAgICAgIGp1bmtmb3VuZDIgOj0gaW5kZXggKGxpbmUxLCAianVuayBmb29kIikKICAgICAgICBpZiBqdW5rZm91bmQxID4gMCB0aGVuCiAgICAgICAgICAgIGJlZm9yZSA6PSBsaW5lMSAoMSAuLiBqdW5rZm91bmQxIC0gMSkKICAgICAgICAgICAgbGluZTIgOj0gIlVuaGVhbHRoeSBUcmVhdHMiCiAgICAgICAgICAgIGFmdGVyIDo9IGxpbmUxIChqdW5rZm91bmQxICsgOSAuLiAqKQogICAgICAgICAgICBsaW5lMSA6PSBiZWZvcmUgKyBsaW5lMiArIGFmdGVyCiAgICAgICAgZWxzaWYganVua2ZvdW5kMiA+IDAgdGhlbgogICAgICAgICAgICBiZWZvcmUgOj0gbGluZTEgKDEgLi4ganVua2ZvdW5kMiAtIDEpCiAgICAgICAgICAgIGxpbmUyIDo9ICJ1bmhlYWx0aHkgdHJlYXRzIgogICAgICAgICAgICBhZnRlciA6PSBsaW5lMSAoanVua2ZvdW5kMiArIDkgLi4gKikKICAgICAgICAgICAgbGluZTEgOj0gYmVmb3JlICsgbGluZTIgKyBhZnRlcgogICAgICAgIGVuZCBpZgogICAgICAgIHB1dCA6IFN0cmVhbU51bTIsIGxpbmUxCiAgICBlbmQgbG9vcAogICAgY2xvc2UgOiBTdHJlYW1OdW0xCiAgICBjbG9zZSA6IFN0cmVhbU51bTIKZW5kIGlmCgpvcGVuIDogU3RyZWFtTnVtMSwgImp1bmtmb29kZml4ZWQudHh0I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