import java.util.Scanner;
public class main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("크로아티아어를 입력하세요");
String inputAlphabet = sc.next();
System.out.println(getCountWords(inputAlphabet));
}
static int getCountWords(String alphabet){
int count = 0;
String[] newAlphabet = alphabet.split("",100);
for(int i=0; i<(newAlphabet.length)-1; i++){
if(newAlphabet[i].equals("c")){
if((newAlphabet[i+1].equals("="))||(newAlphabet[i+1].equals("-"))){
count--;
}
}
if(newAlphabet[i].equals("d")){
if(newAlphabet[i+1].equals("z")) {
if (newAlphabet[i+2].equals("=")) {
count --;
}
}
if(newAlphabet[i+1].equals("-")){
count--;
}
}
if((newAlphabet[i].equals("l")) || (newAlphabet[i].equals("n"))){
if(newAlphabet[i+1].equals("j")){
count--;
}
}
if((newAlphabet[i].equals("s")) || (newAlphabet[i].equals("z"))){
if(newAlphabet[i+1].equals("=")){
count--;
}
}
count++;
}
return count;
}
}
외않되~~~갸르륵
'디팔이의 개발공부 > 백준풀이 및 연습' 카테고리의 다른 글
[백준] 1316 - 그룹단어체커 (0) | 2022.10.14 |
---|
댓글