## Group Assignment

View as PDF

Points: 3
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Mr. Benum is assigning his class into groups for a large assignment. There are 3 groups and the group a person is placed into depends on the first letter of their last name. If the first letter is between A-I, they are to be placed in group 1. If the letter is between J-S they are in group 2. Otherwise, they are assigned to group 3. Given a student's last name, determine their group.

#### Input

The only line of input is the student's last name beginning with a capital letter followed by 1 or more lowercase letters.

#### Output

Print Group 1., Group 2. or Group 3. depending on the student.

#### Sample Input

Corey

#### Sample Output

Group 1.

• John_Park  commented on Dec. 8, 2020, 1:52 a.m.

Hmm. I did this by getting the unicode value of the first character of the last name (65-73 for capital A-I, 74-83 for capital J-S, and else for everything else), and deciding the groups that the students belong in using that. Although the program works perfectly, it is slightly limited, in that if the first letter to come in is a lowercase they'll be put into Group 3 automatically (Although this problem can be mitigated by turning the entire name into capital letters before running it through the logic).

Long story short, I'm not sure if I'm allowed to solve this problem in this way. If so, please tell me, and I'll try to make a second version of it that uses another method.

• sankeeth_ganeswaran  commented on Dec. 8, 2020, 11:06 p.m.

The only line of input is the student's last name beginning with a capital letter followed by 1 or more lowercase letters.

The first letter will always be capital in the input, your submission is fine :)

• Eric_Zhang  commented on Dec. 10, 2020, 7:33 p.m.

Hi Sankeeth :D