NSA - Name Scraping

no tags 

Description

The NSA is analyzing their data and looking for possible names.
A name starts with an uppercase letter and is followed by zero or more letters (of any case). For example, Ben, McKay, and T are names; ben, mcKay, and T_ are not names.
Given an sequence of characters, how many names are there?
For example, Ben_aT8McK has eight names:
  1. B
  2. M
  3. K
  4. T
  5. Be
  6. Mc
  7. Ben
  8. McK

Input

A non-empty sequence of up to 30,000 characters. All characters are ASCII letters, numbers, or underscores.

Output

The number of names. Include any duplicates in your count.
Input Input Input Input
Ben_McK8aT
correct_horse_battery_staple
ABCDEFGHIKLMNOPQRSTUVWXYZ
LL1
Output Output Output Output
8
0
325
3

hide comments
Mitch Schwartz: 2013-10-25 00:19:24

Moved to tutorial.


Added by:BYU Admin
Date:2013-10-18
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64