ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 백준 5622 JAVA
    ETC/Algorithm 2023. 5. 19. 23:13
    import java.io.*;
    
    public class Main {
        public static void main(String[] args) throws IOException {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
    
    
            String[] strings = br.readLine().split("");
            int count = 0;
            for (String string : strings) {
                switch (string) {
                    case "A":
                    case "B":
                    case "C":
                        count += 3;
                        break;
                    case "D":
                    case "E":
                    case "F":
                        count += 4;
                        break;
                    case "G":
                    case "H":
                    case "I":
                        count += 5;
                        break;
                    case "J":
                    case "K":
                    case "L":
                        count += 6;
                        break;
                    case "M":
                    case "N":
                    case "O":
                        count += 7;
                        break;
                    case "P":
                    case "Q":
                    case "R":
                    case "S":
                        count += 8;
                        break;
                    case "T":
                    case "U":
                    case "V":
                        count += 9;
                        break;
                    case "W":
                    case "X":
                    case "Y":
                    case "Z":
                        count += 10;
                        break;
                }
            }
            bw.write(String.valueOf(count));
            bw.flush();
        }
    }

    댓글

Designed by black7375.