یک جمله داده شده است، تابعی بنویسید که حرف اول هر کلمه را به کلمه بعدی در جمله منتقل کند (انتقال به راست).
نمونه ورودی و خروجی
ShiftSentence("create a function") ➞ "freate c aunction"
ShiftSentence("it should shift the sentence") ➞ "st ihould shift she tentence"
ShiftSentence("backendbaz") ➞ "backendbaz"
نکات:
- حرف اول آخرین کلمه به اولین کلمه در جمله منتقل میشود.
- تمام جملات با حروف کوچک نوشته شدهاند.
- توجه کنید که کلمات تکی بدون تغییر باقی میمانند (مثال شماره 3).
Assert.Equal("freate c aunction", Backendbaz.ShiftSentence("create a function")); Assert.Equal("st ihould shift she tentence", Backendbaz.ShiftSentence("it should shift the sentence"));
نظرات