Palindrome or not
The starter reads one word of up to 63 letters into word. Finish it so it says whether the word is a palindrome: a word that reads the same forwards and backwards. Capitals count as the same letter as their lower-case twin, so Racecar is a palindrome.
Use two pointers. One starts on the first byte of word, the other on the last letter, which is the byte just before the terminating zero. Load a byte through each with ldrb, fold capitals to lower case, and compare. The first mismatch settles the answer; if the pointers meet or cross without one, the word is a palindrome.
In ASCII a capital sits exactly 32 below its lower-case letter, so adding 32 to any byte from 'A' to 'Z' folds it. Doing that twice per step is a good job for a small leaf subroutine, one that calls no other subroutine.
Print the word as it was typed, followed by is a palindrome or is not a palindrome, using the two format strings in .data.
What is checked
- the verdict for the word in the stdin box, and for more words you cannot see (so it has to work for any word)
- the program exits cleanly
- the letters are read one byte at a time (
ldrb)
specification
ldrbWe run your program on the input above and on the hidden ones, and compare what it does. Nothing is matched against a stored solution.