3. Palindrome

EasyProgramFree10 points

Write isPalindrome s, which is true when the string s reads the same forwards and backwards, and false otherwise.

Compare characters exactly: spaces count, and an upper-case letter differs from its lower-case form.

Examples

  1. InputisPalindrome "racecar"Outputtrue
  2. InputisPalindrome "lean"Outputfalse
  3. InputisPalindrome ""Outputtrue

Submitting also runs 8 hidden tests.

Constraints

  • The empty string is a palindrome.
Solution.lean
Loading editor…

Run checks your code against the examples and your custom inputs and records nothing. Submit also runs the hidden tests, confirms the axioms your proof uses and records the result. Each uses one compiler check.

ReadyLn 1, Col 1Lean 4
Draft saved in this browser