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


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

Satr berilgan bo`lib uning birinchi ikkita simvolidan hosil bo`lgan yangi satr qaytaring. Agar satr uzunligi 2 dan kam bo`lsa, yetmagan simvollar o`rniga ‘@’ belgisini qo`ying.

atFirst("hello") → "he"


atFirst("hi") → "hi"
atFirst("h") → "h@"

String-1 > lastChars 
prev  |  next  |  chance

Given 2 strings, a and b, return a new string made of the first char of a and the last char of b, so "yo" and "java" yields "ya". If either string is length 0, use '@' for its missing char.

oxirgiBelgilar.

Ikkita a va b satr berilgan, a satrning birinchi va b satrning oxirgi belgisidan hosil bo`lgan yangi satr qaytaring. Agar ikkala satrdan birortasining uzunligi 0 ga teng bo`lsa olinadigan belgi o`rniga ‘@’ belgisini qo`yilgan holda qaytaring.


String-1 > conCat 
prev  |  next  |  chance

Given two strings, append them together (known as "concatenation") and return the result. However, if the concatenation creates a double-char, then omit one of the chars, so "abc" and "cat" yields "abcat".

Ikkita satr berilgan, ularni birin-ketin joylashtish natijasida yangi yaxlit bir satr qaytiring. Agar, satrlar qo`shilishi natijasida bir xil belgilar ketma-ket kelsa bittasi o`chirilsin. Masalan: “abc” va “cat”ni qo`shilishi natijasida “abcat” hosil bo`ladi.


String-1 > lastTwo 
prev  |  next  |  chance

Given a string of any length, return a new string where the last 2 chars, if present, are swapped, so "coding" yields "codign".

Oxirgi2.


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