5-Topshiriq


Download 0.72 Mb.
Sana18.06.2023
Hajmi0.72 Mb.
#1591009
Bog'liq
2-Amaliyot


2-Amaliyot
Botirov Dostonbek
5-Topshiriq
On programming contests each team consists of three people and has a name. Write a program that for a team name and surnames of the participants, the full name of the team builds.
Full name of the team consists of a short list of team names and the names of its members. Names of the participants in the list must be sorted alphabetically and separated by exactly one comma and space and must be brackets on both side(see examples).
Input
 The Input contains exactly 4 lines. The first line contains the name of team. Each of the following three lines contains the surname of one of the teammates. The Lengths of the lines do not exceed 50 symbols.
Output
Output must contain exactly one line, containing full team name.
Tarjimasi:
Dasturlash musobaqalarida har bir jamoa uch kishidan iborat bo'lib, o'z nomiga ega. Jamoa nomi va ishtirokchilarning familiyalari, jamoaning to'liq nomi tuziladigan dasturni yozing.
Jamoaning to'liq nomi jamoa nomlarining qisqa ro'yxati va uning a'zolarining ismlaridan iborat. Roʻyxatdagi ishtirokchilarning ismlari alifbo tartibida tartiblangan boʻlishi va bitta vergul va boʻsh joy bilan ajratilishi hamda ikkala tomonidagi qavslar boʻlishi kerak (misollarga qarang).
Kiritish:
Kirish aniq 4 qatordan iborat. Birinchi qatorda jamoa nomi ko'rsatilgan. Quyidagi uchta qatorning har birida jamoadoshlardan birining familiyasi mavjud. Chiziqlar uzunligi 50 ta belgidan oshmaydi.
Chiqish:
Chiqish to'liq jamoa nomini o'z ichiga olgan bitta qatorni o'z ichiga olishi kerak.


Samples



Input

Output

1

Team#6
Yusupova
Yuldoshova
Jumaboeva

Team#6(Jumaboeva, Yuldoshova, Yusupova)

2

TUIT Urgench Branch#4
Odilov
Xusinov
Axmedov

TUIT Urgench Branch#4(Axmedov, Odilov,Xusinov)



Dastur kodi:
#include
#include
#include


using namespace std;


int main() {
string team_name, name1, name2, name3;
getline(cin, team_name);
getline(cin, name1);
getline(cin, name2);
getline(cin, name3);

// ismlarni to'g'irlash va vergullar bilan ajratish
string names[3] = {name1, name2, name3};
sort(names, names + 3);
string surnames = names[0] + ", " + names[1] + ", " + names[2];

cout << team_name << " (" << surnames << ")" << endl;

return 0;
}
Natija:


Download 0.72 Mb.

Do'stlaringiz bilan baham:




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