fork(2) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int il = 1;
  13. String string;
  14. int polowa=2;
  15. Scanner in = new Scanner(System.in);
  16. il = in.nextInt();
  17. if(il < 1 || il>100) {System.exit(0);}
  18. while(il!=-1) {il--;
  19. string = in.nextLine();
  20. if(string.length()>1000) {System.exit(0);}
  21. if(string.length()%2 == 0) {polowa = string.length()/2;}
  22. if(string.length()%2 != 0) {polowa = 1+(string.length()/2);}
  23. string = string.substring(0, polowa);
  24. System.out.println(string);
  25.  
  26. }
  27.  
  28. }
  29. }
Success #stdin #stdout 0.06s 2249728KB
stdin
3
pierwszy
lubiec
ktotozrobi
stdout
pier
lub
ktoto