Algorithm
[백준-8959번/Java] OX 퀴즈
1984
2022. 11. 10. 18:07
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = Integer.parseInt(sc.nextLine());
for (int i = 0; i < N; i++) {
int point = 1;
int sum = 0;
String str = sc.nextLine();
for (char c : str.toCharArray()) {
if (c == 'O') {
sum += point;
point++;
} else if (c == 'X') {
point = 1;
}
}
System.out.println(sum);
}
sc.close();
}
}
728x90