Solución UVA Tex Quotes
package TEX_Quotes_272;
import java.util.Scanner;
public class TEX_Quotes_272 {
public static void main(String[] args) {
String cadena;
Scanner leer = new Scanner(System.in);
int cont = 1;
do {
cadena = leer.nextLine();
for (int i = 0; i < cadena.length(); i++) {
if (cadena.charAt(i) == '"') {
if (cont % 2 != 0) {
System.out.print("``");
} else {
System.out.print("''");
}
cont++;
} else {
System.out.print(cadena.charAt(i));
}
}
System.out.println();
} while (leer.hasNext());
}
}
No hay comentarios:
Publicar un comentario