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


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


String-1 > helloName 
prev  |  next  |  chance

Given a string name, e.g. "Bob", return a greeting of the form "Hello Bob!"

salomIsm

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










String-1 > makeAbba 
prev  |  next  |  chance

Given two strings, a and b, return the result of putting them together in the order abba, e.g. "Hi" and "Bye" returns "HiByeByeHi".

abbaYasang

a va b satrlar berilgan, ularni abba ko`rinishida ketma-ket joylashtirish orqali yangi satr hosil qiling. Masalan: “Salom” va “Xayr” ekranga “SalomXayrXayrSalom” bo`lib qaytadi.

String-1 > makeTags 
prev  |  next  |  chance

The web is built with HTML strings like "Yay" which draws Yay as italic text. In this example, the "i" tag makes and which surround the word "Yay". Given tag and word strings, create the HTML string with tags around the word, e.g. "Yay".

tegYasang

Web sahifa huddi “PDPStorm” kabi HTML teglaridan tashkil topgan hisoblanadi. Bunda “i” tegi va ko`rinishida “PDPStorm” so`zini atrofini o`rab uni italic formatida ekranga chiqaradi. Berilgan teg nomi va satrdan foydalanib HTML kodini string shaklida qaytaring. Masalan: “PDPStorm”.


String-1 > makeOutWord 
prev  |  next  |  chance

Given an "out" string length 4, such as "<<>>", and a word, return a new string where the word is in the middle of the out string, e.g. "<>". Note: use str.substring(i, j) to extract the String starting at index i and going up to but not including index j.

so`zniChegarala

Simvollardan iborat “<<>>” ko`rinishidagi va uzunligi 4 ga teng bo`lgan satr va so`z berilgan. Berilgan so`zni simvollarning o`rtasiga “<>” holatida joylashtirilgan yangi satr qaytaring. Eslatma: bu masalani yechishda str.substring(i,j) funksiyasidan foydalaning. Bunda i Stringni boshlang`ich elementidan j gacha bo`lganini qaytaradi.




String-1 > extraEnd 
prev  |  next  |  chance

Given a string, return a new string made of 3 copies of the last 2 chars of the original string. The string length will be at least 2.

qo`shimchaYakun

String berilgan shu stringni oxirgi 2 ta elementini 3 marta takrorlagan holda yangi string qaytaring. Berilgan string uzunligi kamida 2 ga teng bo`ladi.


String-1 > firstTwo 



Given a string, return the string made of its first two chars, so the String "Hello" yields "He". If the string is shorter than length 2, return whatever there is, so "X" yields "X", and the empty string "" yields the empty string "". Note that str.length() returns the length of a string.

birinchiIkki

Berilgan satrni dastlabki ikkita elementidan hosil bo`lgan yangi satr qaytaring. Agar satr uzunligi 2 dan kichik bo`lsa qanday element bo`lsa o`zi qaytarilsin. Masalan: “X”->”X” yoki “”->”” qaytsin. Eslatma: str.length() satr uzunligini qaytaradi.


String-1 > firstHalf 
prev  |  next  |  chance

Given a string of even length, return the first half. So the string "WooHoo" yields "Woo".

birinchiYarim

Juft son uzunligidagi satr berilgan. Sartning birinchi yarmi qaytarilsin. Masalan: “SalomStorm” dan “Salom” hosil bo`ladi.


String-1 > withoutEnd 
prev  |  next  |  chance

Given a string, return a version without the first and last char, so "Hello" yields "ell". The string length will be at least 2.

boshVaOxirsiz.

Berilgan satrning birinchi va oxirgi elementini olib tashlagan holadagi satr qaytarilsin. Masalan: “Salom” dan “alo” so`zi hosil bo`ladi.


String-1 > comboString 
prev  |  next  |  chance

Given 2 strings, a and b, return a string of the form short+long+short, with the shorter string on the outside and the longer string on the inside. The strings will not be the same length, but they may be empty (length 0).


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