import java.io.*;
public class Main {
static String ReadLn (int maxLg) // utility function to read from stdin
{
byte lin[] = new byte [maxLg];
int lg = 0, car = -1;
String line = "";
try
{
while (lg < maxLg)
{
car = System.in.read();
if ((car < 0) || (car == '\n')) break;
lin [lg++] += car;
}
}
catch (IOException e)
{
return (null);
}
if ((car < 0) && (lg == 0)) return (null); // eof
return (new String (lin, 0, lg));
}
public static void main (String args[]) // entry point from OS
{
Main myWork = new Main(); // create a dynamic instance
myWork.Begin(); // the true entry point
}
void Begin()
{
String input;
StringBuilder s;
boolean starting=true;
while ((input = Main.ReadLn (255)) != null)
{
s=new StringBuilder(input);
while(s.indexOf("\"")!=-1)
{
if(starting)
{
s.replace(s.indexOf("\""),s.indexOf("\"")+1, "``");
starting=false;
}
else {
s.replace(s.indexOf("\""),s.indexOf("\"")+1, "''");
starting=true;
}
}
System.out.println(s);
}
}
}
0 comments: