Write a Ruby program to create a new string from a given string with the last character added at the front and back of the given string
- برمجة روبي
- برمجة
- 2021-08-29
- mhanasmh00489829403
الأجوبة
def temp(str)
len = str.length() - 1;
return (str.split('')[len] + str + str.split('')[len]);
end
print temp("abc"),"\n"
print temp("abcd"),"\n"
print temp("java")
Output:
cabcc dabcdd ajavaa
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال