Advertisement
Guest User

Untitled

a guest
Aug 29th, 2014
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. 3
  2. Ruby
  3. Diamond
  4. Sapphire
  5.  
  6. import java.util.Scanner;
  7.  
  8. public class GemStones {
  9.  
  10. private int numOfStones;
  11. private String[] gemArray;
  12.  
  13. public void solve() throws Exception{
  14.  
  15. Scanner in = new Scanner(System.in);
  16.  
  17. //Reading the integer
  18. numOfStones = Integer.parseInt(in.nextLine());
  19. //in.nextLine();
  20. System.out.println(numOfStones);
  21.  
  22.  
  23. //reading the strings
  24. for(int i=0;i<numOfStones;i++){
  25. gemArray[i] = in.nextLine();
  26. System.out.println(gemArray[i]);
  27. }
  28.  
  29.  
  30. for(int i=0;i<numOfStones;i++){
  31. System.out.println(gemArray[i]);
  32. }
  33. in.close();
  34. }
  35.  
  36.  
  37. public static void main(String[] args) throws Exception {
  38. GemStones check = new GemStones();
  39. check.solve();
  40.  
  41.  
  42. }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement