## Back to School '16: Dodgeball

View as PDF

Points: 7 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

Today in gym class, your class decided to play dodgeball, and aurpine is selected as one of the team captains! students are lined up in a row, waiting to be put on teams. aurpine is allowed to pick multiple students as long as they are adjacent to one another, and the first letter of each of their names are the same (case insensitive).

As an assistant to aurpine, help him decide what his first choice should be by writing a program to determine all the possible choices he could make!

#### Input Specification

The first line contains the integer , representing the total number of students.

The second line contains space separated strings, each representing the name of the student in line. Each name will be no longer than characters and only contain letters from the English alphabet.

#### Output Specification

Output one integer, representing the total number of choices aurpine can make. Since this number can be very large, output it modulo .

#### Sample Input

5
Sarah Timmy Turner Betty Bob

#### Sample Output

7

#### Explanation for Sample Output

The possible groups of people that aurpine could choose are:

• Sarah
• Timmy
• Turner
• Betty
• Bob
• Timmy, Turner
• Betty, Bob

• commented on June 20, 2021, 1:33 p.m. edited

Since the original data were weak, additional test cases were added by me, worth marks that require implementing all aspects of the problem.

• commented on May 27, 2017, 8:49 a.m.

The test cases are not strong - a solution without the modulo passes too.

• commented on Sept. 18, 2016, 9:56 a.m.

What is output for: 7 cdedc dbbec deaec dacea eabbd bacba ddcda Is it 11 ?

• commented on Sept. 18, 2016, 10:29 a.m.

10

• commented on Sept. 16, 2016, 10:40 p.m. edited

This comment is hidden due to too much negative feedback. Click here to view it.