Swift Basic Programming Exercise: Take the first two characters from a given string and create a new string with the two characters added at both the front and back
Write a Swift program to take the first two characters from a given string and create a new string with the two characters added at both the front and back.
Pictorial Presentation:

Sample Solution:
Swift Code:
Sample Output:
swswiftsw ababcab ababab aaa
Swift Programming Code Editor:
Improve this sample solution and post your code through Disqus
Previous: Write a Swift program to check if a given non-negative number is a multiple of 3 or a multiple of 5.
Next: Write a Swift program to test a given string whether it starts with "Is". Return true or false.
What is the difficulty level of this exercise?
Based on 748 votes, average difficulty level of this exercise is Medium
.