TopCoder problem "BrokenKeyboardRepair" used in TCHS07 Gamma 3 (Division I Level One)



Problem Statement

    

All the alphabetical keys on your keyboard are broken. Given a String word, return the minimal number of keys you must repair to be able to type word.

 

Definition

    
Class:BrokenKeyboardRepair
Method:minimalNumberOfKeys
Parameters:String
Returns:int
Method signature:int minimalNumberOfKeys(String word)
(be sure your method is public)
    
 

Constraints

-word will contain between 1 and 50 characters, inclusive.
-word will contain only lowercase letters ('a'-'z').
 

Examples

0)
    
"coder"
Returns: 5
You have to repair the following keys: 'c', 'd', 'e', 'o', 'r'.
1)
    
"hello"
Returns: 4
You have to repair the following keys: 'e', 'h', 'l', 'o'.
2)
    
"abracadabra"
Returns: 5
You have to repair the following keys: 'a', 'b', 'c', 'd', 'r'.

Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=7555

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=10720&pm=7555

Writer:

andrewzta

Testers:

PabloGilberto , brett1479 , Olexiy

Problem categories:

Simple Search, Iteration