fork(5) download
  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;
  4.  
  5. public class Main {
  6. public static void main(String[] args) throws NumberFormatException, IOException {
  7.  
  8.  
  9. int n = Integer.parseInt(br.readLine());
  10.  
  11. for (int x = 0; x < n; x++) {
  12. String str = br.readLine();
  13. String[] arr = str.split(" ");
  14.  
  15. System.out.print("Case #" + (x + 1) + ": ");
  16.  
  17. for (int y = arr.length - 1; y >= 0; y--) {
  18. System.out.print(arr[y] + " ");
  19. }
  20. System.out.println();
  21. }
  22. }
  23. }
Success #stdin #stdout 0.16s 55564KB
stdin
3
this is a test
foobar
all your base
stdout
Case #1: test a is this 
Case #2: foobar 
Case #3: base your all