TCCC '23 Sept P1 - Classroom Conundrum

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 128M

Author:
Problem type

Thornhill Computer Club 2023 - September Contest - Problem 1

ZSS, a secondary school on the planet of Zorktoi, has just started their new school year! Mr. Z, a teacher of ZSS has recently obtained his new teaching schedule consisting of 4 courses he is teaching this semester. However, since ZSS is a big school, Mr. Z has trouble locating the room number for his new classes. Luckily for him, the room number of a class can be determined from the name of the course being taught.
The room number system works as follows:

  • The first number is equivalent to the length of the course name.
  • The next number is equivalent to the grade of the course.
  • The last number is the sum of the location of the first and last letter of the course name within the alphabet.
  • All three numbers are separated by dashes.

For example, the course 15 AdvancedZorkiology, would have the room number of 18-15-26.

Since the length of AdvancedZorkiology is 18 letters long, the first number is 18.
Since the course if for grade 15, the second number is 15.
Since the the first and last letters are A (the 1st letter of the alphabet) and y (the 25th letter of the alphabet), the last number is 26 (1 + 25).

Given a schedule of 4 classes. Can you help him find the room number to each of his classes?

Input Specifications

There will be a total of 4 lines of input.
On each line, there will one integer G (1 \le G \le 99) representing the grade of the course and a string S with length l (2 \le l \le 99) representing the name of that course.

Output Specifications

Output 4 total lines, the room number for each course in the same order as given.

Sample Input 1

38 PolorizedChemistry
13 AdditionalAddition
17 ExponentialLogarithms
2 CountableCounters

Sample Output 1

18-38-41
18-13-15
21-17-24
17-2-22

Comments

There are no comments at the moment.