Skip to content

Commit 63136fc

Browse files
committed
[Silver V] Title: 크로아티아 알파벳, Time: 76 ms, Memory: 11616 KB -BaekjoonHub
1 parent a725c77 commit 63136fc

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# [Silver V] 크로아티아 알파벳 - 2941
2+
3+
[문제 링크](https://www.acmicpc.net/problem/2941)
4+
5+
### 성능 요약
6+
7+
메모리: 11616 KB, 시간: 76 ms
8+
9+
### 분류
10+
11+
구현(implementation), 문자열(string)
12+
13+
### 문제 설명
14+
15+
<p>예전에는 운영체제에서 크로아티아 알파벳을 입력할 수가 없었다. 따라서, 다음과 같이 크로아티아 알파벳을 변경해서 입력했다.</p>
16+
17+
<table class="table table-bordered table-center-20 th-center td-center">
18+
<thead>
19+
<tr>
20+
<th>크로아티아 알파벳</th>
21+
<th>변경</th>
22+
</tr>
23+
</thead>
24+
<tbody>
25+
<tr>
26+
<td>č</td>
27+
<td>c=</td>
28+
</tr>
29+
<tr>
30+
<td>ć</td>
31+
<td>c-</td>
32+
</tr>
33+
<tr>
34+
<td>dž</td>
35+
<td>dz=</td>
36+
</tr>
37+
<tr>
38+
<td>đ</td>
39+
<td>d-</td>
40+
</tr>
41+
<tr>
42+
<td>lj</td>
43+
<td>lj</td>
44+
</tr>
45+
<tr>
46+
<td>nj</td>
47+
<td>nj</td>
48+
</tr>
49+
<tr>
50+
<td>š</td>
51+
<td>s=</td>
52+
</tr>
53+
<tr>
54+
<td>ž</td>
55+
<td>z=</td>
56+
</tr>
57+
</tbody>
58+
</table>
59+
60+
<p>예를 들어, ljes=njak은 크로아티아 알파벳 6개(lj, e, š, nj, a, k)로 이루어져 있다. 단어가 주어졌을 때, 몇 개의 크로아티아 알파벳으로 이루어져 있는지 출력한다.</p>
61+
62+
<p>dž는 무조건 하나의 알파벳으로 쓰이고, d와 ž가 분리된 것으로 보지 않는다. lj와 nj도 마찬가지이다. 위 목록에 없는 알파벳은 한 글자씩 센다.</p>
63+
64+
### 입력
65+
66+
<p>첫째 줄에 최대 100글자의 단어가 주어진다. 알파벳 소문자와 '-', '='로만 이루어져 있다.</p>
67+
68+
<p>단어는 크로아티아 알파벳으로 이루어져 있다. 문제 설명의 표에 나와있는 알파벳은 변경된 형태로 입력된다.</p>
69+
70+
### 출력
71+
72+
<p>입력으로 주어진 단어가 몇 개의 크로아티아 알파벳으로 이루어져 있는지 출력한다.</p>
73+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import java.io.BufferedReader;
2+
import java.io.IOException;
3+
import java.io.InputStreamReader;
4+
5+
public class Main {
6+
public static void main(String[] args) throws IOException {
7+
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
8+
String line = br.readLine();
9+
String[] arr = {"c=", "c-", "dz=", "d-", "lj", "nj", "s=", "z="};
10+
11+
for (int i = 0; i < arr.length; i++) {
12+
line = line.replace(arr[i], "a"); // 크로아티아 알파벳을 a로 바꿔준다.
13+
}
14+
System.out.println(line.length());
15+
}
16+
}

0 commit comments

Comments
 (0)