یک جمله داده شده است، تابعی بنویسید که حرف اول هر کلمه را به کلمه بعدی در جمله منتقل کند (انتقال به راست).
نمونه ورودی و خروجی
ShiftSentence("create a function") ➞ "freate c aunction"
ShiftSentence("it should shift the sentence") ➞ "st ihould shift she tentence"
ShiftSentence("backendbaz") ➞ "backendbaz"
نکات:
- حرف اول آخرین کلمه به اولین کلمه در جمله منتقل میشود.
- تمام جملات با حروف کوچک نوشته شدهاند.
- توجه کنید که کلمات تکی بدون تغییر باقی میمانند (مثال شماره 3).
EXPECT_EQ(ShiftSentence("create a function"), "freate c aunction"); EXPECT_EQ(ShiftSentence("it should shift the sentence"), "st ihould shift she tentence"); EXPECT_EQ(ShiftSentence("backendbaz"), "backendbaz"); EXPECT_EQ(ShiftSentence("the output is not very legible"), "lhe tutput os iot nery vegible"); EXPECT_EQ(ShiftSentence("tey ghis uot hnscrambled"), "hey this got unscrambled"); EXPECT_EQ(ShiftSentence("i love to eat scrambled eggs and ham"), "h iove lo tat ecrambled sggs end aam"); EXPECT_EQ(ShiftSentence("mitochondria is the powerhouse of the cell"), "citochondria ms ihe towerhouse pf ohe tell");
پاسخ های کاربران به این تمرین
برای مشاهده پاسخ باید ابتدا وارد شده و قفل پاسخ را باز کنید
نظرات