Qo`shimchaBosh.
Berilgan satrning boshidagi 2 ta simvolini 3 marta takrorlashdan hosil bo`lgan yangi satr qaytaring. Satr uzunligi istalgan qiymatda bo`lishi mumkin. Agar satr uzunligi 2 dan kichik bo`lsa berilgan belgi 3 marta qaytarilsin.
String-1 > without2
prev | next | chance
Given a string, if a length 2 substring appears at both its beginning and end, return a string without the substring at the beginning, so "HelloHe" yields "lloHe". The substring may overlap with itself, so "Hi" yields "". Otherwise, return the original string unchanged.
2Siz.
Satr berilgan bo`lib agar satrning boshidagi va oxiridagi 2 belgi bir xil bo`lsa boshidagi belgilar o`chrilgan holatdagi yangi satr qaytaring, masalan “HelloHe” dan “lloHe” satri hosil bo`ladi. Agar berilgan satrning boshi ham oxiri ham faqat o`zidan iborat bo`lsa unda “” bo`sh qiymat qaytarilsin. Qolgan barcha hollarda satrni o`zgarishsiz qaytaring.
without2("HelloHe") → "lloHe"
without2("HelloHi") → "HelloHi"
without2("Hi") → ""
|
String-1 > deFront
prev | next | chance
Given a string, return a version without the first 2 chars. Except keep the first char if it is 'a' and keep the second char if it is 'b'. The string may be any length. Harder than it looks.
Berilgan satrning birinchi ikkita belgisini olib tashlangan holdagi yangi qiymatini qaytaring. Istisno holatida agar birinchi belgi ‘a’ ga va ikkinchi belgi ‘b’ ga teng bo`lsa bu belgilar olib tashlanmasin. Berilgan satr istalgan uzunlikda bo`lishi mumkin.
deFront("Hello") → "llo"
deFront("java") → "va"
deFront("away") → "aay"
|
String-1 > startWord
prev | next | chance
Given a string and a second "word" string, we'll say that the word matches the string if it appears at the front of the string, except its first char does not need to match exactly. On a match, return the front of the string, or otherwise return the empty string. So, so with the string "hippo" the word "hi" returns "hi" and "xip" returns "hip". The word will be at least length 1.
|
Do'stlaringiz bilan baham: |