Write a program, in a programming language of your choice, that reads names (single words) one at a time from the keyboard until the word "quit" is entered. It should then print the words in the given order on a single line, but with the order of the letters in each word reversed.
A sample session is given below
next word (type quit to stop): john
next word (type quit to stop): michael
next word (type quit to stop): george
next word (type quit to stop): quit
nhoj leahcim egroeg
13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1.
We call this the Collatz sequence for 13, and it has 10 terms (including 13 and 1 themselves). Starting at different numbers gives Collatz sequences of different lengths. For example, the sequence starting at n=97 has 119 terms, which is the longest sequence with starting number less than 100.
It is thought that every Collatz sequence will eventually arrive at 1 (the Collatz conjecture) but it has not yet been proved!
Which starting number under 10,000 has the longest Collatz sequence? Note that although the starting number must be less than 10,000, the numbers in the sequence might get much bigger than 10,000.
Write a program in a programming language of your choice that solves this problem. The program must compute the answer itself (do not solve the problem by hand!) and it must print the answer to the standard output.
Solve one of the two problems above in a programming language of your choice. Make sure that your code compiles (if you are using a compiled language) and runs successfully before submitting.
Submit your code via email to john.fearnley@liverpool.ac.uk with topic "COMP105 Transfer Assignment". Send only the source files and do not send compiled executables (the email system may silently drop your submission if you do). Please include your student ID in the body of your email. You should receive a response within one working day.
The final deadline for this task is Sunday the 29th of September. You will be notified of the outcome on or before Monday the 30th of September.
Note that the final deadline is after the end of week 1. If you would like to ensure that you are transferred before week 1, please submit your solution by Sunday the 22nd of September