공부기록/백준

[백준] 2941번 크로아티아 알파벳

메델 2023. 10. 15. 19:29
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner kb = new Scanner(System.in);
        String[] find = {"c=", "c-", "dz=", "d-", "lj", "nj", "s=", "z="};
        String str = kb.next();
        
        for (int i = 0; i < find.length; i++) {
            if (str.contains(find[i]))
                str = str.replace(find[i], "*");
        }
        System.out.println(str.length());

    }
}