|
|
back to boardwhy WA 14? please help me !!!!! import java.util.Scanner; public class T_1226_esreveR_redrO { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ String set="ABCDEFGHIJKLMNOPQRSTUVXYZWabcdefghijklmnopqrstuvxyzw"; String s =sc.nextLine(); String p=""; for (int i = 0; i < s.length(); i++) { if(set.indexOf(s.charAt(i)+"")>-1) p=s.charAt(i)+p; else{ System.out.print(p); p=""; System.out.print(s.charAt(i)); } } System.out.println(p); } } } Re: why WA 14? please help me !!!!! Posted by Unknown 17 Apr 2013 18:14 public class T_1226 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String l = ""; char c; while (br.ready()) { char s = (char) br.read(); if ((65<=s && 90>=s)||(97<=s && 122>=s)) { l = s + l; } else { System.out.print(l + s); l = ""; } } System.out.print(l); } } My code Accepted!!! Edited by author 17.04.2013 18:28 |
|
|