boj)2941 - 크로아티아 알파벳

2020. 11. 5. 16:00PS/boj

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import java.io.*;
 
public class boj_2941 {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static String[] strs = {"c=""c-""dz=""d-""lj""nj""s=""z="};
 
    public static void main(String[] args) throws IOException {
        String str = br.readLine();
        String s = str;
 
        for (int i = 0; i < 8; i++) {
            s = s.replaceAll(strs[i], "0");
        }
 
        System.out.println(s.length());
    }
 
}
 
cs

 

- 아이디어가 좋다고 생각했는데 이렇게 푼 사람이 많았네

 

 

 


www.acmicpc.net/problem/2941

 

'PS > boj' 카테고리의 다른 글

boj)11729 - 하노이 탑 이동 순서  (0) 2020.11.11
boj)2589 - 보물섬  (0) 2020.11.11
boj)1316 - 그룹 단어 체커  (0) 2020.11.05
boj)11719 - 그대로 출력하기 2  (0) 2020.11.05
boj)11721 - 열 개씩 끊어 출력하기  (0) 2020.11.05