Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 649. Return the first and last character of a string

Created by @bmtran

Return the first and last character of a string, concatenated together. If there is only one character in the string, the function should give that character back twice since it is both the first and last character of the string.

Example:

   stringfirstandlast('boring example') = 'be'

Problem Group

Solution Statistics

384 correct solutions 160 incorrect solutions
Last solution submitted on Aug 23, 2014