?
# | Author | Problem | Lang | Verdict | Time | Memory | Sent | Judged | |
---|---|---|---|---|---|---|---|---|---|
1426873 |
Contestant: GoomboCode |
168B - 51 | Java 7 | Wrong answer on pretest 2 | 90 ms | 43800 KB | 2012-03-27 19:37:54 | 2012-03-27 19:37:57 |
import java.io.*; import java.util.*; public class B implements Runnable { BufferedReader br; StringTokenizer st; PrintWriter out; String nextToken() throws IOException { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } int nextInt() throws IOException { return Integer.parseInt(nextToken()); } String nextStr() throws IOException { return nextToken(); } char nextChar() throws IOException { return nextToken().charAt(0); } long nextLong() throws IOException { return Long.parseLong(nextToken()); } double nextDouble() throws IOException { return Double.parseDouble(nextToken()); } public void solve() throws IOException { StringBuilder answer = new StringBuilder(); int cnt = 0; do { String tmp = br.readLine(); boolean t = false; for ( int i=0; i<tmp.length(); ++i ) { if ( tmp.charAt(i) != ' ' ) { if ( tmp.charAt(i) == '#' ) t = true; break; } } if ( t == false ) { for ( int i=0; i<tmp.length(); ++i ) { if ( tmp.charAt(i) != ' ' ) { answer.append(tmp.charAt(i)); } } }else { if ( cnt != 0 ) answer.append('\n'); answer.append(tmp); answer.append('\n'); } ++cnt; }while ( br.ready() ); out.println( answer.toString() ); } public void run() { try { br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(new OutputStreamWriter(System.out)); st = new StringTokenizer(""); solve(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } finally { out.close(); } } public static void main(String[] args) { new Thread(new B()).start(); } }
?
?
?
?