WC '15 Contest 4 J2 - Mission Briefing

View as PDF

Submit solution


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

Author:
Problem type
Woburn Challenge 2015-16 Round 4 - Junior Division

You've gotten your hands on M's writeup of plans for an upcoming MI6 mission. This mission briefing is a single string, whose length is between 1 and 1000 (inclusive), and which consists only of letters, digits, periods, and commas (no whitespace).

You know that 9 different MI6 agents may be involved in this mission – the agents with code names 001, 002, 003, 004, 005, 006, 007, 008, and 009. Some of their code names may appear in the mission briefing, even multiple times, while others may not. Their code names may occur anywhere in the string, not necessarily immediately before or after punctuation. You're interested in counting the number of different agents whose code names can be found in the text at least once.

Input Specification

The first and only line of input consists of a single string representing a transcript of the mission briefing.

Output Specification

Output a single integer – the number of different agents (from 001 to 009) whose code names appear in the mission briefing.

Sample Input

Agent.007.will.take.up.position.on.the.roof.of.20001.Wales.Street,while.002.and.009.will.cover.the.entrance...007.will.take.the.first.shot.

Sample Output

4

Comments


  • 0
    QiQi  commented on Dec. 3, 2021, 5:02 a.m. edited

    Isn't the amount of different agents 3 because it says "Output a single integer – the number of different agents (from 001 to 009) whose code names appear in the mission briefing." and the agents are 001,002,and 009.Did I miss something or am I right?


    • 2
      uselessleaf  commented on Dec. 3, 2021, 10:43 p.m.

      Agent.007.will.take.up.position.on.the.roof.of.20001.Wales.Street,while.002.and.009.will.cover.the.entrance...007.will.take.the.first.shot.

      Therefore the agents are 001, 002, 007, and 009, you are missing something, and you are not right.