
import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int testcase = Integer.parseInt(br.readLine()); String str; for(int i=0;i<testcase;i++){ int score = 0; int sum = 0; str = br.readLine(); for(int j=0;j<str.length();j++){ if(str.charAt(j)=='O') { score++; sum += score; } else if(str.charAt(j)=='X'){ score = 0; } } System.out.println(sum); } } }
오늘 목표치 끝!!
아무런 도움없이 혼자서 처음부터 끝까지 구현한 건 두 문제? 정도인 것 같지만 뿌듯하다
'Algorithm > [BOJ] - JAVA' 카테고리의 다른 글
[백준] 11720 : 숫자의 합 JAVA 풀이 (0) | 2022.05.14 |
---|---|
[백준] 11654 : 아스키 JAVA 풀이 (0) | 2022.05.14 |
[백준] 4344 : 평균은 넘겠지 JAVA 풀이 (0) | 2022.05.12 |
[백준] 1546 : 평균 JAVA 풀이 (0) | 2022.05.12 |
[백준] 3052 : 나머지 JAVA 풀이 (0) | 2022.05.12 |