How to resolve the algorithm Odd word problem step by step in the PicoLisp programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Odd word problem step by step in the PicoLisp programming language
Table of Contents
Problem Statement
Write a program that solves the odd word problem with the restrictions given below.
You are promised an input stream consisting of English letters and punctuations.
It is guaranteed that:
A stream with six words:
The task is to reverse the letters in every other word while leaving punctuations intact, producing: while observing the following restrictions:
Work on both the "life" example given above, and also the text:
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Odd word problem step by step in the PicoLisp programming language
Source code in the picolisp programming language
(de oddWords ()
(use C
(loop
(until (sub? (prin (setq C (char))) "!,.:;?"))
(T (= "." C))
(setq C (char))
(T
(= "."
(prin
(recur (C)
(if (sub? C "!,.:;?")
C
(prog1 (recurse (char)) (prin C)) ) ) ) ) ) )
(prinl) ) )
(in "txt1" (oddWords))
(in "txt2" (oddWords))
You may also check:How to resolve the algorithm Terminal control/Display an extended character step by step in the Racket programming language
You may also check:How to resolve the algorithm Averages/Mode step by step in the PL/I programming language
You may also check:How to resolve the algorithm Unix/ls step by step in the Pascal programming language
You may also check:How to resolve the algorithm Long multiplication step by step in the AutoHotkey programming language
You may also check:How to resolve the algorithm Harmonic series step by step in the Lua programming language