import java.util.*; import java.net.*; import java.io.*; class Sock{ public static String getFlag(String hostName, Integer port){ int bufferSize = 20; byte[] data = new byte[bufferSize]; String output = ""; try{ Socket socket = new Socket(hostName, port); for(int i = 0; i < bufferSize; i++){ if(socket.getInputStream().read(data, i, 1) <= 0){ break; } //socket.getInputStream().read(data, i, 1); //0 to indeks gdzie zaczynay, output = output + (char) data[i]; } socket.close(); } catch(IOException e){ System.out.println(e); } return output; } } class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); Integer port = scan.nextInt(); System.out.println(Sock.getFlag("127.0.0.1", port)); //wyprintuje SUCCESS } }