-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ8958.java
More file actions
38 lines (35 loc) · 1.17 KB
/
Q8958.java
File metadata and controls
38 lines (35 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* Date: 2018. 10. 19.
* Author: inhyuck | https://github.com/inhyuck
* Solution URL: https://github.com/inhyuck/problem-solving
* Title: OX퀴즈
* description: OX퀴즈의 결과가 주어졌을 때, 점수를 구하는 프로그램을 작성하시오. 링크 참조.
* Problem URL: https://www.acmicpc.net/problem/8958
*/
package io.inhyuck.strings;
import java.io.*;
public class Q8958 {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
int t = Integer.parseInt(reader.readLine());
String input;
int sum, point;
while (t-- > 0) {
sum = 0;
point = 0;
input = reader.readLine();
for (char c : input.toCharArray()) {
if (c == 'X') {
sum += point;
point = 0;
continue;
}
sum += point++;
}
sum += point;
writer.write(sum + "\n");
}
writer.flush();
}
}