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


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


String-2 > doubleChar 
prev  |  next  |  chance

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

ikkilanganBelgi

Berilgan satrning har bir belgisi ikkilangan holatdagi yangi satr qaytaring. Masalan, “PDP” “PPDDPP”;


doubleChar("The") → "TThhee"


doubleChar("AAbb") → "AAAAbbbb"
doubleChar("Hi-There") → "HHii--TThheerree"

String-2 > countHi 
prev  |  next  |  chance

Return the number of times that the string "hi" appears anywhere in the given string.

Hi”niSana



Berilgan satrning istalgan joyida joylashgan “hi” so`zining sanog`ini qaytaring.

countHi("abc hi ho") → 1


countHi("ABChi hi") → 2
countHi("hihi") → 2

String-2 > catDog 
prev  |  next  |  chance

Return true if the string "cat" and "dog" appear the same number of times in the given string.


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