백준 문제풀이
[백준] 2941번
Dodledd
2024. 4. 27. 21:37
어렵지않다.. 어렵게 생각해서 짜면 손해다
힌트는 어떤 크로아티아 알파벳이든 1글자로 치환이 된다.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class b2941 {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
String[] arrStr = new String[] {"c=", "c-", "dz=", "d-", "lj", "nj", "s=", "z="};
String str = bf.readLine();
for (String s : arrStr) {
if (str.contains(s)) {
str = str.replace(s, "a");
}
}
System.out.println(str.length());
}
}