Loading...
viktor.nikolov avatar viktor.nikolov 6 Точки

Проблем при Здарача 06. Courses

Здравейте, реших задачата но немога да подредя правилно принтирането

условие :

6.Courses

Write a program, which keeps information about courses. Each course has a name and registered students.

You will receive course name and student name, until you receive the command "end". Check if such course already exists, and if not, add the course. Register the user into the course. When you do receive the command "end", print the courses with their names and total registered users, ordered by the count of registered users in descending order. For each contest print registered users ordered by name in ascending order.

Input

  • Until you receive "end", the input come in the format: "{courseName} : {studentName}".
  • The product data is always delimited by " : ".

Output

  • Print information about each course, following the format:
    "{courseName}: {registeredStudents}"
  • Print information about each student, following the format:
    "-- {studentName}"

Examples

Input

Output

Programming Fundamentals : John Smith

Programming Fundamentals : Linda Johnson

JS Core : Will Wilson

Java Advanced : Harrison White

end

Programming Fundamentals: 2

-- John Smith

-- Linda Johnson

JS Core: 1

-- Will Wilson

Java Advanced: 1

-- Harrison White

Algorithms : Jay Moore

Programming Basics : Martin Taylor

Python Fundamentals : John Anderson

Python Fundamentals : Andrew Robinson

Algorithms : Bob Jackson

Python Fundamentals : Clark Lewis

end

Python Fundamentals: 3

-- Andrew Robinson

-- Clark Lewis

-- John Anderson

Algorithms: 2

-- Bob Jackson

-- Jay Moore

Programming Basics: 1

-- Martin Taylor

ето и решението ми : https://pastebin.com/USw8Af04

Тагове:
0
Fundamentals Module
boykopk avatar boykopk 147 Точки

Здравей,

не си направил сортировката по броя на юзърите в курс: When you do receive the command "end", print the courses with their names and total registered users, ordered by the count of registered users in descending order. For each contest print registered users ordered by name in ascending order.

0
06/11/2018 13:58:28
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.