알고리즘 및 자료구조/문제

백준알고리즘 2941번 크로아티아 알파벳

ktko 2018. 5. 14. 09:05

백준알고리즘


https://www.acmicpc.net/problem/2941


import java.util.*; public class Main { public static void main(String[] args) { Scanner scan = new Scanner (System.in); String inputStr = scan.nextLine().trim(); String[] checkArray = { "c=", "c-", "dz=", "d-", "lj", "nj", "s=", "z=" }; for(int i=0; i<8; i++) { inputStr = inputStr.replaceAll(checkArray[i], ";"); } System.out.println(inputStr.length()); scan.close(); } }