Last active
April 8, 2022 03:21
-
-
Save Trimad/87eefb23621cc6b4f7b35b09a5e0382d to your computer and use it in GitHub Desktop.
UVa 272
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* * * * * * * * * | |
* Tristan Madden | |
* 10/17/2017 | |
* UVa 272 | |
* * * * * * * * */ | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args){ | |
Scanner sc = new Scanner(System.in); | |
boolean verticalMarks = false; | |
while (sc.hasNextLine()) { | |
StringBuilder sb = new StringBuilder(); | |
String input = sc.nextLine(); | |
for (int i = 0; i < input.length(); i++) { | |
if (input.charAt(i) == 34) { | |
if (!verticalMarks) { | |
sb.append("``"); | |
verticalMarks = true; | |
} else if (verticalMarks) { | |
sb.append("''"); | |
verticalMarks = false; | |
} | |
} else { | |
sb.append(input.charAt(i)); | |
} | |
} | |
System.out.println(sb); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment