fork download
  1. import java.io.Console;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5. public static void main(String[] args) {
  6. Scanner input = new Scanner(System.in);
  7.  
  8. int liczbaTestow = 0, dlugoscSlowa = 0;
  9. liczbaTestow = input.nextInt();
  10. String slowo = "";
  11.  
  12. for (int i = 0; i < liczbaTestow; i++) {
  13. slowo = input.next();
  14. dlugoscSlowa = slowo.length();
  15. System.out.println(slowo.substring(0, (dlugoscSlowa/2)));
  16. }
  17. }
  18. }
Success #stdin #stdout 0.07s 213312KB
stdin
3
pierwszy
lubiec
ktotozrobi
stdout
pier
lub
ktoto