TopCoder problem "RoomNumber" used in SRM 351 (Division II Level One)



Problem Statement

    

You are going to stick the number of your room on the door. The shop near your house suggests wonderful sets of plastic digits. Each set contains exactly ten digits - one of each digit between 0 and 9, inclusive. Return the number of sets required to write your room number. Note that 6 can be used as 9 and vice versa.

 

Definition

    
Class:RoomNumber
Method:numberOfSets
Parameters:int
Returns:int
Method signature:int numberOfSets(int roomNumber)
(be sure your method is public)
    
 

Constraints

-roomNumber will be between 1 and 1,000,000, inclusive.
 

Examples

0)
    
122
Returns: 2
Two sets are required because each set contains only one '2' digit.
1)
    
9999
Returns: 2
Each set contains one '6' digit and one '9' digit. '6' could be used as '9' and therefore two sets are enough.
2)
    
12635
Returns: 1
3)
    
888888
Returns: 6

Problem url:

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

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=10675&pm=6764

Writer:

Andrew_Lazarev

Testers:

PabloGilberto , brett1479 , Olexiy

Problem categories:

Simple Math, String Manipulation