Problem
My Solution
1import java.util.Scanner;
2
3public class Main {
4
5 public static void main(String[] args){
6
7 Scanner sc = new Scanner(System.in);
8
9 boolean verticalMarks = false;
10
11 while (sc.hasNextLine()) {
12
13 StringBuilder sb = new StringBuilder();
14
15 String input = sc.nextLine();
16
17 for (int i = 0; i < input.length(); i++) {
18
19 if (input.charAt(i) == 34) {
20
21 if (!verticalMarks) {
22
23 sb.append("``");
24
25 verticalMarks = true;
26
27 } else if (verticalMarks) {
28
29 sb.append("''");
30
31 verticalMarks = false;
32
33 }
34
35 } else {
36
37 sb.append(input.charAt(i));
38
39 }
40
41 }
42
43 System.out.println(sb);
44
45 }
46
47 }
48
49}