Logo
(追記) (追記ここまで)

18008번 - ReMorse 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 512 MB79585079.365%

문제

Morse code is an assignment of sequences of dot and dash symbols to alphabet characters. You are to reassign the sequences of Morse code so that it yields the shortest total length to a given message, and return that total length.

A dot symbol has length 1. A dash symbol has length 3. The gap between symbols within a character encoding has length 1. The gap between character encodings has length 3. Spaces, punctuation, and alphabetic case are ignored, so the text

The quick brown dog jumps over the lazy fox.

is encoded as though it were

THEQUICKBROWNDOGJUMPSOVERTHELAZYFOX

For instance, for the input ICPC, the answer is 17. Encode the Cs with a single dot, the I with a dash, and the P with two dots, for an encoding of

− ∙ ∙∙ ∙

which has length (3) + 3 + (1) + 3 + (1 + 1 + 1) + 3 + (1) = 17.

입력

The single line of input consists of a string s (1 ≤ |s| ≤ 32000) of upper-case or lower-case letters, spaces, commas, periods, exclamation points, and/or question marks. Everything but the letters should be ignored. The line will contain at least one letter.

출력

Output a single integer, which is the length of s when encoded with an optimal reassignment of the sequences of Morse code.

제한

예제 입력 1

ICPC

예제 출력 1

17

예제 입력 2

A

예제 출력 2

1

예제 입력 3

The quick brown dog jumps over the lazy fox.

예제 출력 3

335

힌트

출처

ICPC > Regionals > North America > Southeast USA Regional > 2019 Southeast USA Regional Programming Contest > Division 2 K번

ICPC > Regionals > North America > Pacific Northwest Regional > 2019 ICPC Pacific Northwest Region > Division 2 X번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /