Write a racket function called substring-lengths that


A string may be split into two substrings of equal lengths if the length of the string is an even integer. However, if the length of the string is odd, the length of the first half should be one less than the length of the second half.

Write a Racket function called substring-lengths that consumes a non-empty string s and produces a new string obtained by concatenating substrings of s and their lengths strictly as follows:

  • the length of the first half of s,
  • the first half of s,
  • the length of the second half of s,
  • the second half of s, and
  • the length of s.

For example:

  • (substring-lengths "a") => "01a1"
  • (substring-lengths "computer") => "4comp4uter8"

Solution Preview :

Prepared by a verified Expert
Business Management: Write a racket function called substring-lengths that
Reference No:- TGS02921815

Now Priced at $10 (50% Discount)

Recommended (93%)

Rated (4.5/5)