fork download
  1. var line1, line2, before, after : string
  2. var StreamNum1, StreamNum2, junkfound1, junkfound2, space2, space3, space4 : int
  3.  
  4. open : StreamNum1, "junkfood.txt", get
  5.  
  6. if StreamNum1 < 0 then
  7. put "File Access error: 404 or file not readable"
  8. else
  9. open : StreamNum2, "junkfoodfixed.txt", put
  10. loop
  11. exit when eof (StreamNum1)
  12. get : StreamNum1, line1 : *
  13. junkfound1 := index (line1, "Junk Food")
  14. junkfound2 := index (line1, "junk food")
  15. if junkfound1 > 0 then
  16. before := line1 (1 .. junkfound1 - 1)
  17. line2 := "Unhealthy Treats"
  18. after := line1 (junkfound1 + 9 .. *)
  19. line1 := before + line2 + after
  20. elsif junkfound2 > 0 then
  21. before := line1 (1 .. junkfound2 - 1)
  22. line2 := "unhealthy treats"
  23. after := line1 (junkfound2 + 9 .. *)
  24. line1 := before + line2 + after
  25. end if
  26. put : StreamNum2, line1
  27. end loop
  28. close : StreamNum1
  29. close : StreamNum2
  30. end if
  31.  
  32. open : StreamNum1, "junkfoodfixed.txt", get
  33.  
  34. if StreamNum1 < 0 then
  35. put "File Access error: 404 or file not readable"
  36. else
  37. open : StreamNum2, "junkfoodfixed2.txt", put
  38. loop
  39. exit when eof (StreamNum1)
  40. get : StreamNum1, line1 : *
  41. space4 := index (line1, " ")
  42. space3 := index (line1, " ")
  43. space2 := index (line1, " ")
  44. if space4 > 0 then
  45. before := line1 (1 .. space4)
  46. after := line1 (space4 + 3 .. *)
  47. line1 := before + after
  48. end if
  49. if space3 > 0 then
  50. before := line1 (1 .. space3)
  51. after := line1 (space3 + 2 .. *)
  52. line1 := before + after
  53. end if
  54. if space2 > 0 then
  55. before := line1 (1 .. space2)
  56. after := line1 (space2 + 1 .. *)
  57. line1 := before + after
  58. end if
  59. put line1
  60. put : StreamNum2, line1
  61. end loop
  62. close : StreamNum1
  63. close : StreamNum2
  64. end if
  65.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty