Java is the future !: front22

Monday, October 11, 2010


You've given a string, take the first 2 chars and return the string with the 2 chars added at both the front and back, so "blogger" yields"blbloggerbl". If the string length is less than 2, use whatever chars are there.

front22("chankey") → "chchankeych"
front22("Na") → "NaNaNa"
front22("xyz") → "xyxyzxy"

Solution :

No comments:

Post a Comment