Given a string, return a string where for every char in the original, there are two chars


ItMushuk Agar berilgan satrda “dog” va “cat” so`zi teng marotaba qaytarilgan bo`lsa true qiymat qaytarilsin


Download 86.5 Kb.
bet2/4
Sana08.01.2022
Hajmi86.5 Kb.
#234727
1   2   3   4
Bog'liq
CodingBat String 2

ItMushuk

Agar berilgan satrda “dog” va “cat” so`zi teng marotaba qaytarilgan bo`lsa true qiymat qaytarilsin.

catDog("catdog") → true


catDog("catcat") → false
catDog("1cat1cadodog") → true

String-2 > countCode 
prev  |  next  |  chance

Return the number of times that the string "code" appears anywhere in the given string, except we'll accept any letter for the 'd', so "cope" and "cooe" count.

Code”niSana



Berilgan satrning istalgan joyidagi “code” so`zining sanog`ini qayatding, istisno holatida “d” harfi o`rniga istalgan harf qatnashsa ham hisobga o`tadi. Masalan, “cope” , “cooe” va h.k

countCode("aaacodebbb") → 1


countCode("codexxcode") → 2
countCode("cozexxcope") → 2

String-2 > endOther 
prev  |  next  |  chance

Given two strings, return true if either of the strings appears at the very end of the other string, ignoring upper/lower case differences (in other words, the computation should not be "case sensitive"). Note: str.toLowerCase() returns the lowercase version of a string.

NarginingOxiri

Berilgan ikkita satrning istalgan bittasi nargisining eng oxirgi qismida joylashgan bo`lsa true qiymat qaytarilsin. (Bunda str.toLowerCase metodi yordamidan foydalanib satrlar solishtirilsin)

endOther("Hiabc", "abc") → true


endOther("AbC", "HiaBc") → true
endOther("abc", "abXabc") → true

String-2 > xyzThere 
prev  |  next  |  chance

Return true if the given string contains an appearance of "xyz" where the xyz is not directly preceeded by a period (.). So "xxyz" counts but "x.xyz" does not.

xyzBormi


Download 86.5 Kb.

Do'stlaringiz bilan baham:
1   2   3   4




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