Back From Summer '17 P1: Pithy Pastimes

View as PDF

Submit solution


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

Author:
Problem type
Chalk Board

As you step into your school after a long summer break, you take a deep breath.

New experiences. Friends. Knowledge. All of these and more await as you come back to your educational institute.

Your first class is English, and your teacher, Joey, is new to your school. To familiarize himself with his new students, Joey creates an icebreaker; he will ask each student for their favorite hobbies. He then proceeds to create a list on the chalkboard composed out of these activities (note: repeats are included).

What you find out soon is that your new teacher is extremely lazy, and when he hears one of the students call out a hobby that is strictly longer than 10 characters, he just nods instead of writing it down and moves on to the next student.

Given the hobbies that each student in your class tells Joey, how many will be on the board by the end of the ice breaker?

Input Specification

The first line will contain an integer (1 \le N \le 10\,000), the number of students in your class. This will then be followed by a line of N words that represent the hobbies called out by the students.

Output Specification

The only output is an integer representing the number of hobbies on the chalkboard once all the students have said theirs.

Sample Input 1

5
Piano Programming Pottery Protesting Pen-spinning

Sample Output 1

3

Explanation for Sample Output 1

For the first example (seen in the picture above), Piano (5 characters), Pottery (7 characters), and Protesting (10 characters) are all written down, whereas Programming (11 characters) and Pen-spinning (12 characters) are not as they are over 10 characters long.

Sample Input 2

3
Photography Photography Photography

Sample Output 2

0

Explanation for Sample Output 2

The second example sure does have a lot of students who enjoy photography! But as this hobby is 11 characters long, it is never written down.

Sample Input 3

8
Paintball Parkour Poker Philately Poker Puzzles Puzzles Photography

Sample Output 3

7

Comments


  • 0
    oscarhuang885  commented on Jan. 21, 2023, 7:40 a.m.

    Why is one of the hobbies say protesting? Just wondering.


  • -2
    computer_class  commented on Jan. 4, 2023, 6:22 p.m.

    Can someone tell me what i am doing wrong?


    • 1
      NY0  commented on Jan. 4, 2023, 7:55 p.m.

      Firstly, the reason you get IR (meaning there is an error in your code) is because of your line 4. You named your string that stores the input as I, so the computer doesn't know what you mean when you have string_name. This is the first thing that Dingledooper pointed out.

      Secondly, your print statement doesn't work for 3 reasons.

      1. You have a tab in front of your print code, meaning that it is part of your loop. You only want to output anything after you have your final answer. (Dingledooper also pointed this out)
      2. You have it in an if statement, meaning that you will only print if that condition is met, meaning most of the time, you won't output anything.

      3. You have your final answer stored, but you print 3 instead. The only case where this would work is when the answer happens to be 3.

      In the future, please don't make multiple comments of the same thing, it only causes clutter.


      • 0
        computer_class  commented on Jan. 5, 2023, 10:47 a.m.

        Okay im sorry ill try to understand what you meant and try to fix it thanks


  • -2
    computer_class  commented on Jan. 3, 2023, 8:27 p.m.

    Can someone tell me what i am doing wrong?


    • 1
      Dingledooper  commented on Jan. 3, 2023, 8:44 p.m.
      1. You initialized a string as hobby but used string_hobby instead.
      2. Incrementing a variable with t + 1 doesn't do anything; the increment operator is +=.
      3. Your final print statement is on the wrong indentation.

      • 0
        computer_class  commented on Jan. 3, 2023, 8:47 p.m.

        Its still not working and i kinda don't get your suggestions since i just started coding using my teacher's account.


  • 2
    Payne  commented on Oct. 8, 2022, 5:56 p.m.

    so... why does every word start with a p? lmao