Cool Phone Numbers

시간 제한5초메모리 제한1024 MB

요약
ddd-ddd-dddd 형식의 전화번호가 주어지면 서로 다른 숫자가 몇 개인지 센다.
난이도

쉬움10점 중 1점

유형
문자열, 해시맵, 구현
정답자
아직 제출이 없습니다

문제

Phone numbers in USA are of the form ddd-ddd-dddd, i.e., 10 digits. In general, the fewer distinct digits in a phone number, the easier it is to remember the number. As a result, phone numbers with repeating digits are more popular.

Given a phone number, determine how many distinct digits there are in the number.

입력

There is only one input line; it provides the phone number using the above format. The input starts in column 1 and ends in column 12 (10 digits and 2 hyphens).

출력

Print 1-10 (the number of distinct digits) as follows:

  • 1 – if all ten digits are the same, i.e., only one digit in the number, e.g., 888-888-8888
  • 2 – if only two different digits in the number, e.g., 757-577-7577
  • 3 – if only three different digits in the number
  • 4 – if only four different digits in the number
  • 5 – if …
  • …
  • 10 – if ten different digits in the number, e.g., 246-189-0537

예제5

  1. 예제 1

    입력
    888-888-8888
    
    예상 출력
    1
    
  2. 예제 2

    입력
    757-577-7577
    
    예상 출력
    2
    
  3. 예제 3

    입력
    246-189-0537
    
    예상 출력
    10
    
  4. 예제 4

    입력
    012-987-9690
    
    예상 출력
    7
    
  5. 예제 5

    입력
    000-000-0000
    
    예상 출력
    1