SalomIsm String formatida ism berilgan, masalan “Otabek”,ismdan foydlanib “Salom Otabek!” ko`rinishidagi qiymat qaytarilsin


So`zBoshi. satr va “so`z” satri


Download 110 Kb.
bet8/8
Sana08.01.2022
Hajmi110 Kb.
#234790
1   2   3   4   5   6   7   8
Bog'liq
CodingBat String 1

So`zBoshi.

satr va “so`z” satri

startWord("hippo", "hi") → "hi"


startWord("hippo", "xip") → "hip"
startWord("hippo", "i") → "h"

String-1 > withoutX 
prev  |  next  |  chance

Given a string, if the first or last chars are 'x', return the string without those 'x' chars, and otherwise return the string unchanged.

xBelgisiz.

Berilgan satrning birinchi yoki oxirgi belgisi ‘x’ bo`lsa shu satrni shu belgilarni olib tashlagan holdagi qiymatini qaytaring, aks holda satrning o`zi o`zgarishsiz qaytsin.

withoutX("xHix") → "Hi"


withoutX("xHi") → "Hi"
withoutX("Hxix") → "Hxi"

String-1 > withoutX2 
prev  |  next  |  chance

Given a string, if one or both of the first 2 chars is 'x', return the string without those 'x' chars, and otherwise return the string unchanged. This is a little harder than it looks.

xBelgisiz2

Agar berilgan satrdagi birinchi yoki birinchi ikkita belgi ‘x’ bo`lsa satrdagi bu belgini olib tashlangan holdagi yangi satr qaytaring, bo`lamasa satrni o`zini qaytaring.

withoutX2("xHi") → "Hi"


withoutX2("Hxi") → "Hi"
withoutX2("Hi") → "Hi"

Download 110 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling