UVA 272 Java

import java.util.*;

public class main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    boolean check = true;
    while(sc.hasNextLine())
    {
    	String str = sc.nextLine();
    	for(int i=0; i < str.length(); i++)
    	{
    		char c = str.charAt(i);
    		if(c == '\"')
    		{
    			System.out.print(check ? "``" : "\'\'");
    			check = !check;
    		}
    		else
    			System.out.print(c);
    	}
    	System.out.println();
    }
  }
};

留言

這個網誌中的熱門文章

UVA 11321 Java