import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.io.*;
public class main {
public static void main(String[] args) {
Scanner myObj = new Scanner(System.in);
String lit = myObj.nextLine();
System.out.println("<>");
System.out.print(lit);
}
}
I am trying to compute, Horn's formula and I need to pass to the stdin the following input:
(~y | ~m | ~g | ~S | V | ~K | ~T | ~J | ~v | ~U | ~L | ~t | ~D | ~o | ~k | ~s | ~o | ~C | ~A | ~D | ~H | ~C | ~n | ~H | ~o | ~U | ~a | ~Q) & (~y | ~u | ~y | ~B | ~d | ~H | ~n | ~Y | ~i | ~E | ~z | ~b | ~n | ~n | ~V | ~K | ~v | ~w | ~k | ~i | ~J | ~z | ~m | ~C | ~w | ~U | ~H | ~m | ~K | ~w | ~G | ~l | ~u | ~T | ~y | ~V | ~R | ~Y | ~F | ~g | ~A | ~Q | ~M | ~z | ~e | ~X | ~X | ~n | ~j | ~s | ~q) & (~t | ~d | ~o | ~c | ~S | ~y | ~L | ~M | ~h | ~S | ~H | ~Y | ~h | ~l | ~a | ~C | ~w | ~L | ~Y | ~f | ~c | ~v | ~v | ~T | ~s | ~h) & (~D | ~V | ~c | ~X | ~R | Y | ~X | ~q | ~S | ~d | ~P | ~J | ~K | ~I | ~u | ~v | ~Z | ~o | ~M | ~X | ~i | ~z | ~k | ~g | ~J | ~C | ~w | ~C) & (~v | ~S | ~j | ~s | ~x | ~e | ~R | ~G | ~Q | ~E | ~O | ~k | ~f | ~D | ~Z | ~S | ~y | ~X | ~G | ~w | ~M | ~j | U | ~k | ~m | ~V | ~b | ~a | ~a | ~E | ~b | ~N) & (~X | ~e | ~Q | ~X | ~T | ~R | ~c | ~K | ~A | ~u | ~u | ~n | ~c | ~k | ~H | ~k | ~A | ~S | ~x | ~X | ~R | ~Z | ~u | ~C | ~G | ~c | ~t | ~X | ~w | ~S | ~c | ~o | ~Q | ~E | ~X | ~U) & (~B | ~W | ~O | ~i | ~m | ~c | ~c | ~U | ~q | ~O | ~d | ~p | ~k | ~J | ~I | ~M | ~f | ~V | ~S | ~e | ~U | ~P | ~k | ~B | ~G | ~j | ~K | ~G | ~n) & (~R | ~x | ~O | ~D | ~e | ~u | ~B | ~n | ~L | ~W | ~q | ~T | ~y | ~Y | ~b | ~z | ~c | ~F | ~R | ~i | ~s | ~D | ~I | ~x | ~h | ~h | ~F | ~V | ~T | ~D | ~N | ~l | ~u | ~e | ~p | ~V) & (~t | ~v | ~P | ~W | ~X | ~B | ~G | ~i | ~B | k | ~M | ~q | ~G | ~r | ~b | ~C) & (~U | ~O | ~s | ~I | ~n | ~E | ~i | ~e | ~P | ~x | ~w | ~B | ~s | ~t | ~y | ~U | ~D | ~R | ~Y | ~o | ~M | ~e | ~d | ~p | ~J | ~k | ~p | ~g | ~H | ~v | ~J | ~A | ~j | ~Y | ~s | ~q | ~D | ~k | ~d | ~N | ~A | ~W) & (~R | U | ~z | ~M | ~C | ~B | ~K | ~J | ~F | ~D | ~J | ~e | ~n | ~l | ~E | ~Z | ~O | ~t | ~Y | ~f | ~x) & (~A | ~q | ~M | ~B | ~m | ~D | ~N | ~r | ~w | ~t | ~l | v) & (~n | ~x | ~Q | v | ~d | ~A | ~T | ~P | ~J | ~h) & (~k | ~i | ~J | ~Q | ~v) & (~t | ~c | ~q | ~x) & (~I | ~v | ~M | ~g | ~g | ~E | ~O | ~n | ~M | ~T | ~h | ~v | ~X | ~D | ~B | ~R | ~U | ~A | ~g | ~h | ~o | ~j | ~i | ~o | ~p | ~W | ~h | ~X | ~H | ~X | ~K | ~w | ~h | ~x | ~q | ~j | ~v | ~n | ~N | ~d | ~e | ~n | ~k | ~s | ~C | ~V | ~l | ~b | ~S | ~m | ~r) & (~e) & (~J | ~P | ~t | ~x | ~m | ~h | ~D | ~W | ~t | ~n | ~r | ~p | ~O | ~p | ~u | ~H | k | ~u | ~z | ~O | ~I | ~t | ~d | ~f | ~Y | ~U | ~S | ~N | ~u | ~K | ~N | ~H | ~t | ~D | ~V | ~a | ~b | ~d | ~P | ~M | ~A | ~s | ~m | ~q | ~U | ~a | ~y) & (~s | ~p | ~B | ~O | ~A | ~P | ~L | ~h | ~g | ~I | ~I | ~j | ~n | ~v | ~U | ~S | ~u | ~V | ~c | ~f | ~E | ~V | ~S | ~h | ~y | ~G) & (~b | ~S | ~O | ~V | ~s | ~A | ~e | ~C | ~S | ~M | ~I | ~M | ~C | ~X | ~Q | ~Q | ~I | ~q | ~e | ~K | ~n | ~a | ~I | ~u | ~U | ~J | ~y | ~E | ~M | ~F | ~J | ~H | ~N | ~U | ~G | ~A | ~o | ~j | ~m | ~Z | ~K | ~G | ~M) & (~U | ~R | ~T | ~q | ~C | ~i | ~m | ~H | ~E | ~q | ~z | ~E | ~l) & (~u | ~o | ~k | ~h | ~v | ~k | ~M | ~z | ~X | ~s | ~v | ~s | ~t | ~Q | ~g | ~Z | ~Y | ~E | ~S | ~S | ~m | ~G | ~U | ~u | ~H | ~k | ~m | ~o | ~d | ~Y | ~q | ~I | ~W | ~b | ~B | ~a | ~p | ~R | ~K | ~X | ~s | ~y | ~X | ~R | ~O | ~t | ~I | ~G | ~O) & (~x | W | ~U | ~S | ~j | ~Q | ~l | ~P) & (~D | ~G | ~d | ~t | ~i | ~G | ~P | ~f | ~q | ~k | ~T | ~w | ~D | ~v | ~I | ~u | ~i | ~O | ~R | ~W | ~Q | ~h | ~t | ~t | ~D | ~S | ~A | ~V | ~R | ~f | ~J | ~U | ~s | ~h | ~E | ~c | ~h | ~M | ~W | ~U | ~C | ~Q | ~w | ~G | ~S | ~L | ~y | ~Q | ~D | ~t | ~o) & (~K | ~G | ~Y | ~l | ~S | ~D | ~x | ~Q | ~R | ~M | ~K | ~c | ~R | ~G | ~n | ~P | ~Q | ~b | ~q | ~t | ~S | ~P | ~L | ~W | ~y | ~h | ~Y | ~P | ~K | ~N | ~M | ~L | ~H | ~H | ~w | ~c | ~M | ~T | ~U | ~I | ~o | ~S | ~v | ~Q) & (~S | ~z | G | ~v | ~S | ~R | ~t | ~i | ~R | ~G | ~u | ~b | ~w | ~a | ~e | ~M | ~w | ~R | ~Z | ~V) & (~T | ~B | ~d | ~Q | ~j | ~R | ~E | ~L | ~v | ~C | ~D | ~H | ~S | ~R | ~A | ~S | ~P | ~s) & (~I | ~W | ~J | ~s | ~w | ~O | ~M | ~J | p | ~X | ~Q | ~M | ~b | ~D | ~z | ~s | ~s | ~B | ~a | ~y | ~j | ~b | ~L) & (~s | ~D | ~I | ~J | ~l | ~W | ~C | ~Z | ~R | ~G | ~K | ~H | ~E | ~V | ~H | ~F | ~J | p | ~A) & (~Z | ~N | ~l | ~b | ~k | ~I | ~y | ~x | ~N | ~B | ~X | ~k | ~S | ~j | ~t | ~E | ~Y | ~g | ~g | ~v | ~U | ~l | ~i | ~z | ~l | ~Y | ~v | ~H | ~D | ~m | ~q | ~a | y | ~L | ~u | ~h | ~L) & (~R | ~b | ~k | k | ~n | ~E | ~G | ~s | ~L | ~P | ~b) & (~i | ~F | ~f | ~R | ~I | ~g | P | ~o | ~T | ~s | ~N | ~h | ~n | ~P | ~J | ~G | ~e | ~D | ~j | ~r | ~R | ~D | ~b | ~i | ~o | ~U | ~G | ~r | ~L | ~y | ~z | ~c | ~z | ~V) & (~r | ~r | ~j | ~m | ~a | ~E | ~a | ~f | ~Q | ~B | ~O | ~Y | X | ~L | ~g | ~y | ~t | ~V) & (~b | ~Z | ~H | ~j | ~i | ~q | ~F | O | ~B | ~h | ~Q | ~k | ~P | ~Z | ~m | ~Y | ~V | ~K | ~p | ~j | ~D) & (~V | ~W | ~s | ~T | ~D | ~M | ~l | ~l | ~Y | t | ~s | ~I | ~w | ~K | ~w | ~D | ~W | ~P | ~n | ~w | ~Q | ~t | ~D | ~N | ~A | ~G | ~g) & (~x | ~v | ~F | ~Y | ~K | ~U | ~N | ~e | ~b | ~k | ~v | ~l | ~C | ~w | ~b | ~V | ~v | ~G | ~L | ~e | ~t | ~I | ~U | ~A | ~T | ~z | ~T | ~X | ~l | ~C | ~I | ~X | ~M | ~k | ~y | ~p | ~w | ~z | ~r | ~k | ~I | ~J | ~U | ~V | ~K) & (~c | ~c | ~s | ~O | ~m | ~a | ~G | ~A | ~H | C | ~L | ~T | ~T | ~a | ~y | ~A | ~F | ~U | ~X | ~s | ~u | ~z | ~t | ~H | ~i | ~F | ~I | ~i | ~S | ~e | ~Y | ~l | ~v | ~q | ~Q | ~y | ~F | ~g | ~X | ~I | ~I | ~l | ~p) & (~L | ~P | ~t | ~z | ~o | ~S | ~x | ~O | ~g | ~M | ~D | ~W | ~x | ~K | ~f | ~D | ~v | ~z | ~k | ~V | ~T | ~P | ~B | ~T | ~i | ~I) & (~S | ~I | ~V | ~X | ~P | ~d | ~o | ~x | ~o | ~p | ~I | ~n | ~h | ~P | ~F | ~T | ~w | ~n | ~h | ~m | ~X | ~k | ~T | ~x | ~p | ~Y | ~u | ~M | ~x | ~X | ~q | ~F | ~U | ~P | ~G | ~H | ~i | ~C | ~i | ~f | ~Z | ~T | ~e | ~Y | ~T | ~y | ~e | ~h | ~d | ~i | ~i) & (~H | ~X | ~l | ~s | ~w | ~p | ~S | ~Z | ~S | ~H | ~D | ~E | ~Z | ~g | ~L | ~D | Y | ~t | ~z | ~D | ~U | ~V | ~i | ~Z | ~S | ~i | ~g | ~H | ~f | ~y | ~o | ~B | ~j | ~H | ~v | ~L | ~S | ~k) & (~A | ~N | ~d | ~u | ~X | ~q | ~k | ~w | ~E | ~x | ~w | ~l | ~u | ~x | ~B | ~O | ~v | ~w | ~R | ~S | ~B | ~q | ~O | ~y | ~o | ~D | ~n | ~q | ~o | ~l | ~d | ~M | ~S | ~j | ~T | ~p | ~U | ~X | ~a | ~M | ~P | ~L | ~k | ~N | ~f) & (~H | ~p | ~N | ~t | ~B | ~F | ~U | ~L | ~O | ~s | ~P | ~O | ~b | ~T | ~T | ~e | ~u | ~L | ~w | ~l | ~w | ~o | ~m | ~x | ~C | ~M | ~x | ~X | ~C | ~o | ~Z | ~E | ~c | ~a | ~S | ~t | ~w | ~Y | ~Z | ~U | ~m | ~O | ~g | ~n | ~a | ~L | ~H | ~G) & (~m | ~s | ~V | ~o | ~R | ~K | ~F | ~Q | ~z | ~u | ~k | ~r | ~i | ~N | ~Z | ~W | ~o | ~t | ~u | ~M | ~T | ~A | ~c) & (~n | ~h | ~N | ~F | ~h | ~O | ~i | ~F | ~e | ~n | ~y | ~B | ~j | ~U | ~h | ~e | ~r | ~T | ~d | ~N | ~A | ~t | ~X | ~l | ~h | ~N | ~P | ~D | ~s | ~q | ~k | ~w | ~x | ~f | ~y | ~H | ~B | ~b | ~C | ~u | ~Q | ~l | ~h | ~m | ~l | ~K | ~S | ~g | ~s | ~L | ~Z | ~T) & (~i | ~o | e | ~z | ~e | ~n | ~x | ~I | ~L | ~m | ~H | ~O | ~s | ~y | ~g | ~e | ~u | ~e | ~W) & (~W | ~O | ~p | ~o | ~a | ~e | ~J | ~L | ~p | ~l | ~K | ~D | ~R | ~Q | ~Q | ~x | ~K | ~r | ~e | ~d | ~S | ~W | ~c | ~q | ~D | ~D | ~E | ~a | ~n | ~d | ~b | ~l | ~x | ~Q | ~P | ~L | ~H | ~n | ~a | ~x | ~x | ~Y | ~K | ~A | ~q | ~B | ~m | ~q | ~k | ~R | ~f | ~h) & (~a | ~n | ~Z | ~A | ~W | ~S | ~O | ~V | ~g | ~G | ~K | ~d | ~Z | ~u | ~j | ~S | ~H | ~v | ~a | ~V | ~g | ~G | ~F | ~D | ~n | ~w | ~W | ~W | ~q | ~u | ~C | ~Y | ~C | ~p | ~r | ~v | ~z | ~A | ~P | ~Y | ~s | ~C | ~u | ~g | ~X | ~y | ~Z | ~K | ~N | ~C) & (~h | ~G | ~d | ~g | ~o | ~j | ~B | ~X | ~w | ~h | ~U | ~W | ~T | ~H | ~E | ~J | ~y | ~j | ~Y | ~y | ~u | ~O | ~j | ~b | ~B | ~D | ~M | ~S | ~k | ~Z | ~E | ~m | ~j | ~R | ~G | ~M | ~W | ~g | ~Q | ~A | ~O | ~Y | ~u | ~P | ~H | ~A | ~a) & (~p | ~N | ~w | ~Q | ~y | ~I | ~z | ~s | ~l | ~e | ~x | ~c | ~O | ~L | ~M | ~h | ~D | ~O | ~d | ~D | G | ~I | ~l | ~a | ~J | ~q | ~L | ~O | ~N | ~M | ~Q | ~h | ~o | ~A | ~d | ~a | ~O | ~H) & (~g | ~W | ~G | ~n | H | ~J | ~h | ~g | ~k) & (~y | ~M | ~J | ~F | ~D | ~f | H | ~m | ~h | ~y | ~N | ~o | ~H | ~v | ~B | ~r | ~W | ~b | ~a) & (~H | ~K | ~m | ~u | ~x | ~H | ~l | ~R | ~W | ~b | ~m | ~F | ~L | ~q | ~p | ~Y | ~l | ~z | ~M | ~X | ~X | ~O | ~F | ~s | ~i | ~G | ~H | ~K | ~A | ~y | ~O | ~y | ~p | ~w | ~V | ~b) & (~h | ~X | ~N | ~Q | ~A | ~Y | ~X | ~L | ~C | ~B | ~P | ~T | ~l | ~I | ~V | ~z | ~u | ~M | ~G | ~l) & (~W | ~r | ~d | ~y | ~F | ~T | C | ~k | ~N | ~z | ~G | ~E | ~y | ~i | ~c | ~J | ~u | ~X | ~Z | ~V | ~W | ~Z | ~O | ~y | ~d | ~o | ~p | ~s | ~z | ~e | ~R | ~I | ~Q | ~X | ~E | ~B | ~i | ~M | ~E | ~q | ~H | ~I | ~Y | ~p | ~M) & (~G | ~j | ~b | ~j | ~X | ~s | ~K | ~V | ~D | ~w | ~U | ~L | ~E | ~P | ~U | ~g | ~e | ~O | ~i | ~x | ~t | ~m | ~P | ~t | ~p | ~B | ~E | ~S | ~L | ~Y | ~M | ~A | ~H) & (~U | ~c | ~Q | ~d | ~z | ~K | ~t | ~g | ~x | ~o | ~r | ~J | ~n | ~D | ~O | ~l | ~O | ~Q | ~K | ~r | ~Q | ~z | ~G | ~O | ~e | ~Z | ~o | ~D | ~O) & (~K | ~U | ~U | ~s | ~J | ~w | ~B | ~r | ~R | ~q | ~q | ~D | ~N | ~b | ~J | ~t | ~F | ~D | ~H | ~N | ~a | ~z | ~c | ~Z | ~Z | ~g | ~a | ~g | ~n | ~d | ~d | ~M | ~G) & (~W | ~Q | ~k | ~m | ~K | ~z | ~o | ~o | ~z | ~k | ~x | ~T | ~p | ~S | ~C | ~l | ~S | ~X | ~n | ~j | ~D | ~W | ~w | ~W | ~X | ~w | ~W | ~M | ~a | ~F | ~y | ~W | ~T | ~G | ~k | ~B | ~d | ~m | ~i | ~H | ~C | ~k | ~P | ~W | ~D | ~m) & (~p | ~T | ~t | ~P | ~n | ~k | ~A | ~n | ~Z | ~i | ~l | ~W | ~b | ~O | ~l | ~e | ~f | ~B | T | ~D | ~j | ~q | ~X) & (~c | ~V | ~a | ~E | ~i | ~G | ~X | ~L) & (~f | ~A | ~P | ~F | ~n | ~S | ~p | ~e | ~L | ~K | ~E | ~Y | ~h | ~M | ~b | ~u | ~y | ~a | ~E | ~o | ~k | ~B | ~X | ~k | ~V | ~O | ~R | ~e | ~X | ~h | ~K | ~g | ~W | ~f | ~w) & (~f | ~c | ~Z | ~Y | ~p | ~n | ~i | ~e | ~N | ~a | ~y | ~d | ~v | ~z | ~p | ~H | ~f | ~S | ~E | ~Z | ~S | ~Z | ~w | ~V | ~U | ~T | ~g | ~y | ~B | ~H) & (~I | ~w | ~p | ~P | ~p | ~r | ~m | ~O | ~q | ~r | ~u | ~G | ~u | ~t | ~C | ~B | ~L | ~k | ~x | ~S | ~Q | ~a | ~X | ~o | ~v | ~t | ~O | ~M | ~m | ~M | ~Y | ~E | ~P | ~D | ~m | ~U | ~V | ~y | ~z | ~f | ~I) & (~H | ~k | ~N | ~R | ~H | ~s | ~U | ~T | ~O | ~W | ~M | ~t | ~p | ~e | ~p | ~k | ~s | ~r | ~P | ~e | ~o | ~C | ~Y) & (~w | ~f | ~e | ~c | ~n | ~N | ~A | ~U | ~z | ~p | ~D | ~r | ~d | ~B | ~V | ~J | ~h | ~A | ~b | ~R | ~S | ~T | ~b | ~b | ~p | ~x | ~H | ~r | ~E | ~B | ~l | ~S) & (~L | ~x | ~b | ~i | ~S | ~C | ~s | Y | ~Q | ~A | ~V | ~t | ~f | ~g | ~l | ~G | ~u | ~z | ~P | ~s | ~Y | ~s | ~m | ~b | ~h | ~O | ~Q | ~p | ~e | ~i | ~P | ~G | ~I | ~F) & (~h | ~c | ~t | ~x | ~k | ~X | ~h | ~k | ~y | ~c | ~z | ~j | ~h | ~p | ~S | ~X | ~P | ~y) & (~E | ~Q | ~e | ~O | ~G | ~n | ~o | ~K | ~K | ~E | ~Z | ~H | ~i | ~j | ~U | ~r | ~w | ~E | ~Y | ~L | ~Q | ~v | ~y | ~z | ~R | ~K | ~i | ~D | ~d | ~j | ~C | ~q | ~J | ~u | ~F | ~q) & (~W | ~q | ~n | ~L | ~d | ~Z | ~E | ~b | ~I | ~c | ~a | ~y | ~a | ~b | ~D | ~e | ~a | ~u) & (~J | ~E | ~j | ~k | ~d | ~M | ~i | ~t | ~c | ~U | ~r | ~p | ~Y | ~x | ~c | ~L | ~c | ~a | ~x | ~N | ~H) & (~J | ~x | ~I | ~m | ~B | ~p | ~V | ~B | ~C | ~r | ~t | ~W | ~u | ~M | ~K | ~y | ~s | ~f | ~z | ~m | ~R | ~D | ~Z | ~e | ~n | ~y | ~U | ~t | ~g | ~y | ~U | ~j | ~h | ~z | ~v | ~q | ~s | ~F | ~n | ~r | ~e | ~w | ~Y | ~w) & (e)
But whenever I print it, it does not print everything
Output:
(~y | ~m | ~g | ~S | V | ~K | ~T | ~J | ~v | ~U | ~L | ~t | ~D | ~o | ~k | ~s | ~o | ~C | ~A | ~D | ~H | ~C | ~n | ~H | ~o | ~U | ~a | ~Q) & (~y | ~u | ~y | ~B | ~d | ~H | ~n | ~Y | ~i | ~E | ~z | ~b | ~n | ~n | ~V | ~K | ~v | ~w | ~k | ~i | ~J | ~z | ~m | ~C | ~w | ~U | ~H | ~m | ~K | ~w | ~G | ~l | ~u | ~T | ~y | ~V | ~R | ~Y | ~F | ~g | ~A | ~Q | ~M | ~z | ~e | ~X | ~X | ~n | ~j | ~s | ~q) & (~t | ~d | ~o | ~c | ~S | ~y | ~L | ~M | ~h | ~S | ~H | ~Y | ~h | ~l | ~a | ~C | ~w | ~L | ~Y | ~f | ~c | ~v | ~v | ~T | ~s | ~h) & (~D | ~V | ~c | ~X | ~R | Y | ~X | ~q | ~S | ~d | ~P | ~J | ~K | ~I | ~u | ~v | ~Z | ~o | ~M | ~X | ~i | ~z | ~k | ~g | ~J | ~C | ~w | ~C) & (~v | ~S | ~j | ~s | ~x | ~e | ~R | ~G | ~Q | ~E | ~O | ~k | ~f | ~D | ~Z | ~S | ~y | ~X | ~G | ~w | ~M | ~j | U | ~k | ~m | ~V | ~b | ~a | ~a | ~E | ~b | ~N) & (~X | ~e | ~Q | ~X | ~T | ~R | ~c | ~K | ~A | ~u | ~u | ~n | ~c | ~k | ~H | ~k | ~A | ~S | ~x | ~X | ~R | ~Z | ~u | ~C | ~G | ~c | ~t | ~X | ~w | ~S | ~c | ~o | ~Q | ~E | ~X | ~U) & (~B | ~W | ~O | ~i | ~m | ~c | ~c | ~U | ~q | ~O | ~d | ~p | ~k | ~J | ~I | ~M | ~f | ~V | ~S | ~e | ~U | ~P | ~k | ~B | ~G | ~j | ~K | ~G | ~n) & (~R | ~x | ~O | ~D | ~e | ~u | ~B | ~n | ~L | ~W | ~q | ~T | ~y | ~Y | ~b | ~z | ~c | ~F | ~R | ~i | ~s | ~D | ~I | ~x | ~h | ~h | ~F | ~V | ~T | ~D | ~N | ~l | ~u | ~e | ~p | ~V) & (~t | ~v | ~P | ~W | ~X | ~B | ~G | ~i | ~B | k | ~M | ~q | ~G | ~r | ~b | ~C) & (~U | ~O | ~s | ~I | ~n | ~E | ~i | ~e | ~P | ~x | ~w | ~B | ~s | ~t | ~y | ~U | ~D | ~R | ~Y | ~o | ~M | ~e | ~d | ~p | ~J | ~k | ~p | ~g | ~H | ~v | ~J | ~A | ~j | ~Y | ~s | ~q | ~D | ~k | ~d | ~N | ~A | ~W) & (~R | U | ~z | ~M | ~C | ~B | ~K | ~J | ~F | ~D | ~J | ~e | ~n | ~l | ~E | ~Z | ~O | ~t | ~Y | ~f | ~x) & (~A | ~q | ~M | ~B | ~m | ~D | ~N | ~r | ~w | ~t | ~l | v) & (~n | ~x | ~Q | v | ~d | ~A | ~T | ~P | ~J | ~h) & (~k | ~i | ~J | ~Q | ~v) & (~t | ~c | ~q | ~x) & (~I | ~v | ~M | ~g | ~g | ~E | ~O | ~n | ~M | ~T | ~h | ~v | ~X | ~D | ~B | ~R | ~U | ~A | ~g | ~h | ~o | ~j | ~i | ~o | ~p | ~W | ~h | ~X | ~H | ~X | ~K | ~w | ~h | ~x | ~q | ~j | ~v | ~n | ~N | ~d | ~e | ~n | ~k | ~s | ~C | ~V | ~l | ~b | ~S | ~m | ~r) & (~e) & (~J | ~P | ~t | ~x | ~m | ~h | ~D | ~W | ~t | ~n | ~r | ~p | ~O | ~p | ~u | ~H | k | ~u | ~z | ~O | ~I | ~t | ~d | ~f | ~Y | ~U | ~S | ~N | ~u | ~K | ~N | ~H | ~t | ~D | ~V | ~a | ~b | ~d | ~P | ~M | ~A | ~s | ~m | ~q | ~U | ~a | ~y) & (~s | ~p | ~B | ~O | ~A | ~P | ~L | ~h | ~g | ~I | ~I | ~j | ~n | ~v | ~U | ~S | ~u | ~V | ~c | ~f | ~E | ~V | ~S | ~h | ~y | ~G) & (~b | ~S | ~O | ~V | ~s | ~A | ~e | ~C | ~S | ~M | ~I | ~M | ~C | ~X | ~Q | ~Q | ~I | ~q | ~e | ~K | ~n | ~a | ~I | ~u | ~U | ~J | ~y | ~E | ~M | ~F | ~J | ~H | ~N | ~U | ~G | ~A | ~o | ~j | ~m | ~Z | ~K | ~G | ~M) & (~U | ~R | ~T | ~q | ~C | ~i | ~m | ~H | ~E | ~q | ~z | ~E | ~l) & (~u | ~o | ~k | ~h | ~v | ~k | ~M | ~z | ~X | ~s | ~v | ~s | ~t | ~Q | ~g | ~Z | ~Y | ~E | ~S | ~S | ~m | ~G | ~U | ~u | ~H | ~k | ~m | ~o | ~d | ~Y | ~q | ~I | ~W | ~b | ~B | ~a | ~p | ~R | ~K | ~X | ~s | ~y | ~X | ~R | ~O | ~t | ~I | ~G | ~O) & (~x | W | ~U | ~S | ~j | ~Q | ~l | ~P) & (~D | ~G | ~d | ~t | ~i | ~G | ~P | ~f | ~q | ~k | ~T | ~w | ~D | ~v | ~I | ~u | ~i | ~O | ~R | ~W | ~Q | ~h | ~t | ~t | ~D | ~S | ~A | ~V | ~R | ~f | ~J | ~U | ~s | ~h | ~E | ~c | ~h | ~M | ~W | ~U | ~C | ~Q | ~w | ~G | ~S | ~L | ~y | ~Q | ~D | ~t | ~o) & (~K | ~G | ~Y | ~l | ~S | ~D | ~x | ~Q | ~R | ~M | ~K | ~c | ~R | ~G | ~n | ~P | ~Q | ~b | ~q | ~t | ~S | ~P | ~L | ~W | ~y | ~h | ~Y | ~P | ~K | ~N | ~M | ~L | ~H | ~H | ~w | ~c | ~M | ~T | ~U | ~I | ~o | ~S | ~v | ~Q) & (~S | ~z | G | ~v | ~S | ~R | ~t | ~i | ~R | ~G | ~u | ~b | ~w | ~a | ~e | ~M | ~w | ~R | ~Z | ~V) & (~T | ~B | ~d | ~Q | ~j | ~R | ~E | ~L | ~v | ~C | ~D | ~H | ~S | ~R | ~A | ~S | ~P | ~s) & (~I | ~W | ~J | ~s | ~w | ~O | ~M | ~J | p | ~X | ~Q | ~M | ~b | ~D | ~z | ~s | ~s | ~B | ~a | ~y | ~j | ~b | ~L) & (~s | ~D | ~I | ~J | ~l | ~W | ~C | ~Z | ~R | ~G | ~K | ~H | ~E | ~V | ~H | ~F | ~J | p | ~A) & (~Z | ~N | ~l | ~b | ~k | ~I | ~y | ~x | ~N | ~B | ~X | ~k | ~S | ~j | ~t | ~E | ~Y | ~g | ~g | ~v | ~U
My java version:
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)
Try making a file test.txt and writing input in it and the output will be printed in testout.txt
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.io.*;
public class Main {
public static void main(String[] args) {
String lit="";
try{
FileReader fr=new FileReader("test.txt");
int i;
while((i=fr.read())!=-1)
lit=lit+(char)(i);
fr.close();
}
catch(Exception e){
System.out.println("failed to read file test.txt");
}
try{
FileWriter fw=new FileWriter("testout.txt");
fw.write(lit);
fw.close();
System.out.println("out put is in textout.txt");
}catch(Exception e){
System.out.println(e);
}
}
}
the output will be in textout.txt file.
Related
My program produces an ascii calendar with some events that are stored in an array. I need a way so that in the blank space of the calendar instead it prints the width of the calendar - 1 characters per line. How would I make it so that it only prints (lets say width = 5) the first 4 character, then the next 4.
Note: the program uses a for loop to make each line so it must be one statement that is repeated to print all of the characters in the string.
Example of desired outcome:
======================================================================
| | 1| 2| 3| 4| 5| 6|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
======================================================================
| 7| 8| 9| 10| 11| 12| 13|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
======================================================================
| 14| 15| 16| 17| 18| 19| 20|
| |St. Patri| | | | | |
| |ks day | | | | | |
| | | | | | | |
| | | | | | | |
======================================================================
| 21| 22| 23| 24| 25| 26| 27|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
======================================================================
| 28| | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
======================================================================
Code so far:
public static void drawRow(int row) {
int dayofweek = startingDayOfWeek(month);
int daysinmonth = daysInMonth(month);
int dayspassed = 1;
for(int i = 0; i < row; i++) {
System.out.print("|");
for(int a = 1; a <= 7; a++) {
int length=String.valueOf(10).length();
for(int j = 1; j < Width - length; j++) {
System.out.print(" ");
}
if(dayofweek > 0) {
System.out.print(" ");
dayofweek--;
}
else {
if(dayspassed < 10) {
System.out.print(" ");
}
if(daysinmonth > 0) {
System.out.print(dayspassed);
daysinmonth--;
dayspassed++;
}
else {
System.out.print(" ");
}
}
System.out.print("|");
}
for(int t = 1; t < (Width /2); t++) {
System.out.println();
System.out.print("|");
for(int h = 1; h<=7; h++) {
for(int f = 1; f <= Width - 1; f++) {
eventChecker(month,day);
if(eventCheck == true) {
// part where I need it to either print an event if
// there is one, or line wrap the event.
System.out.print(" ");
}
System.out.print("|");
}
}
System.out.println();
for(int e = 1; e <= Width * 7; e++) {
System.out.print("=");
}
System.out.println();
}
dayspassed = 1;
daysinmonth = daysInMonth(month);
dayofweek = startingDayOfWeek(month);
I've marked the part I need to modify with a comment.
something like this will return the correct character for each cell:
private static char getEventChar(String event, int row, int column, int width) {
// we are interested in the n-th character in this String
int n = row * width + column;
if (n >= event.length()) {
return ' '; // if we passed the end of the name return space-character
}
return event.charAt(n);
}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
I was working on my assignment testing out to make sure it all worked, I accidentally typed an input meant for the console into my code and the output is no longer correct. Here is the code:
import java.util.*;
public class JTCalendar {
//This defines how big the calendar is
public static final int Width = 5;
public static void drawMonth(int month,int day) {
//Ascii art of a robot man
System.out.println(" /\\ /\\");
System.out.println(" / \\ / \\");
System.out.println(" ---------------");
System.out.println("(| (o) (o) |)");
System.out.println(" | wwww |");
System.out.println(" ----------------");
//This finds the center
for(int i = 1; i <= 1; i++) {
for(int j = 1; j <= (Width * 7) / 2; j++) {
System.out.print(" ");
}
System.out.print(month);
for(int d = 1; d <= (Width * 7) / 2 ; d++) {
System.out.print(" ");
}
System.out.println();
I believe the error got put somewhere along this area as this is the area that has a messed up output
}
//Size calculator
for(int g =1; g <= Width * 7; g++) {
System.out.print("=");
}
System.out.println();
drawRow(5);
displayDate(month,day);
}
//Start of the rows
public static void drawRow(int row) {
int day = 1;
for(int i = 0; i < row; i++) {
System.out.print("|");
for(int a = 1; a <= 7; a++) {
int length=String.valueOf(day).length();
for(int j = 1; j < Width - length; j++) {
System.out.print(" ");
}
System.out.print(day);
day++;
System.out.print("|");
}
System.out.println();
for(int t = 1; t < (Width /2); t++) {
System.out.print("|");
for(int h = 1; h<=7; h++) {
for(int f = 1; f <= Width - 1; f++) {
System.out.print(" ");
}
System.out.print("|");
}
}
for(int e = 1; e <= Width * 7; e++) {
System.out.print("=");
}
System.out.println();
}
//End of the rows
}
//Below displays the date
public static void displayDate(int month, int day) {
System.out.println("Month: " + month + "\nDay: " + day);
}
//End display
//Below seperates month and day into two ints
public static int monthFromDate(String date) {
String tokens[] = date.split("/");
return Integer.parseInt(tokens[0]);
}
I'm confident anything below this is proper but I'm still including it
public static int dayFromDate(String date) {
String tokens[] = date.split("/");
return Integer.parseInt(tokens[1]);
}
//End seperation of month and day
public static void main(String[] args) {
//Main scanner console
Scanner console = new Scanner(System.in);
System.out.print("What date would you like to look at? (mm/dd): ");
String date = console.next();
int day = dayFromDate(date);
int month = monthFromDate(date);
drawMonth(month, day);
//This draws the ascii calendar
Calendar cal = Calendar.getInstance();
day = cal.get(Calendar.DATE);
month = cal.get(Calendar.MONTH) + 1;
System.out.println("\nToday is: " + month + "/" + day + "\n");
drawMonth(month,day);
//This draws the calandar for the current date
}
}
Bad output:
/\ /\
/ \ / \
---------------
(| (o) (o) |)
| wwww |
----------------
2
===================================
| 1| 2| 3| 4| 5| 6| 7|
| | | | | | | |===================================
| 8| 9| 10| 11| 12| 13| 14|
| | | | | | | |===================================
| 15| 16| 17| 18| 19| 20| 21|
| | | | | | | |===================================
| 22| 23| 24| 25| 26| 27| 28|
| | | | | | | |===================================
| 29| 30| 31| 32| 33| 34| 35|
| | | | | | | |===================================
Month: 2
Day: 25
Today is: 2/13
/\ /\
/ \ / \
---------------
(| (o) (o) |)
| wwww |
----------------
2
===================================
| 1| 2| 3| 4| 5| 6| 7|
| | | | | | | |===================================
| 8| 9| 10| 11| 12| 13| 14|
| | | | | | | |===================================
| 15| 16| 17| 18| 19| 20| 21|
| | | | | | | |===================================
| 22| 23| 24| 25| 26| 27| 28|
| | | | | | | |===================================
| 29| 30| 31| 32| 33| 34| 35|
| | | | | | | |===================================
Month: 2
Day: 13
Good output:
/\ /\
/ \ / \
---------------
(| (o) (o) |)
| wwww |
----------------
2
===================================
| 1| 2| 3| 4| 5| 6| 7|
| | | | | | | |
===================================
| 8| 9| 10| 11| 12| 13| 14|
| | | | | | | |
===================================
| 15| 16| 17| 18| 19| 20| 21|
| | | | | | | |
===================================
| 22| 23| 24| 25| 26| 27| 28|
| | | | | | | |
===================================
| 29| 30| 31| 32| 33| 34| 35|
| | | | | | | |
===================================
Month: 2
Day: 25
Today is: 2/13
/\ /\
/ \ / \
---------------
(| (o) (o) |)
| wwww |
----------------
2
===================================
| 1| 2| 3| 4| 5| 6| 7|
| | | | | | | |
===================================
| 8| 9| 10| 11| 12| 13| 14|
| | | | | | | |
===================================
| 15| 16| 17| 18| 19| 20| 21|
| | | | | | | |
===================================
| 22| 23| 24| 25| 26| 27| 28|
| | | | | | | |
===================================
| 29| 30| 31| 32| 33| 34| 35|
| | | | | | | |
===================================
Month: 2
Day: 13
You need to add a System.out.println(); after drawing each row:
System.out.println();
for(int t = 1; t < (Width /2); t++) {
System.out.print("|");
for(int h = 1; h<=7; h++) {
for(int f = 1; f <= Width - 1; f++) {
System.out.print(" ");
}
System.out.print("|");
}
}
System.out.println(); // <== ADDED PRINTLN HERE
for(int e = 1; e <= Width * 7; e++) {
System.out.print("=");
}
System.out.println()
The problem is in the drawRow(int row) method , after you print out the '|' character using the for loop then it's not starting in a new line to print out the '=' characters ,you have to insert one System.out.println() statment to make it start in next line
your Code
for(int t = 1; t < (Width /2); t++) {
System.out.print("|");
for(int h = 1; h<=7; h++) {
for(int f = 1; f <= Width - 1; f++) {
System.out.print(" ");
}
System.out.print("|");
}
}
Newer Code
for(int t = 1; t < (Width /2); t++) {
System.out.print("|");
for(int h = 1; h<=7; h++) {
for(int f = 1; f <= Width - 1; f++) {
System.out.print(" ");
}
System.out.print("|");
}
System.out.println(""); //<------------ the only change you need to make
}
I am trying to create a chessboard that looks like this:
---------------------------------
| | | | | | | | |
---------------------------------
| | | | | | | | |
---------------------------------
| | | | | | | | |
---------------------------------
| | | | | | | | |
---------------------------------
| | | | | | | | |
---------------------------------
| | | | | | | | |
---------------------------------
| | | | | | | | |
---------------------------------
| | | | | | | | |
---------------------------------
For some reason I cant get the last line on each row to appear where it suppose to.
Here is my code
public static final int BOARD_SIZE = 8;
public void displayChessBoard(){
for (int row = 0; row < BOARD_SIZE; row++)
{
System.out.println("");
System.out.println("---------------------------------");
for (int column = 0; column < BOARD_SIZE; column++)
{
System.out.print("| " + " " + " ");
}
}
System.out.println("");
System.out.println("---------------------------------");
}
main just calls the method displayChessBoard().
Here is my output
---------------------------------
| | | | | | | |
---------------------------------
| | | | | | | |
---------------------------------
| | | | | | | |
---------------------------------
| | | | | | | |
---------------------------------
| | | | | | | |
---------------------------------
| | | | | | | |
---------------------------------
| | | | | | | |
---------------------------------
| | | | | | | |
---------------------------------
Add another print after the inner for. Like this:
for (int row = 0; row < BOARD_SIZE; row++)
{
System.out.println("");
System.out.println("---------------------------------");
for (int column = 0; column < BOARD_SIZE; column++)
{
System.out.print("| " + " " + " ");
}
System.out.print("|");
}
System.out.println("");
System.out.println("---------------------------------");
Hope it helps...
You are printing 7 pipes, inner for cycle is going from 0 to 7 (column < BOARD_SIZE), just add a pipe print after inner cycle's end.
If you don't mind extra spaces at the end of each line just change for condition to column <= BOARD_SIZE.
You should change the BOARD_SIZE in second for-statement to 9:
This code generates the chess board just like you want:
public static void main(String args[])
{
for (int row = 0; row < 8; row++)
{
System.out.println("");
System.out.println("---------------------------------");
for (int column = 0; column < 9; column++)
{
System.out.print("| " + " " + " ");
}
}
System.out.println("");
System.out.println("---------------------------------");
}
I would like to create this kind of table in MS Excel by using Apache POI:
----------------------------------------------------------------------------
|first_text |last_text | no_text |
----------------------------------------------------------------------------
|col_1|col_2|col_3|col_4|col_5|col_6|col_7|col_8|col_9|col_10|col_11|col_12|
|---------------------------------------------------------------------------
| XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX |
| XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX |
| XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX |
| XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX | XX |
----------------------------------------------------------------------------
I have some problems to combine the areas "first_text" and "last_text" together in the Row. The rest of the table is complete.
How can I create this kind the table overview?
This is what you are looking for
CellRangeAddress region = CellRangeAddress(int firstRow, int lastRow, int firstCol, int lastCol)
sheet.addMergedRegion(region);
public static void main(String[] args) {
Formatter fmt = new Formatter();
String russianAlphabet = " абвгдеёжзийклмнопрстуфхцчшщъыьэюя";
String text = "c точки зрения банальной эрудиции, каждый индивидуум вышедший из сферы эмбрионального развития" +
"не способен патологически идеализировать метаморфические абстракции";
//printing text String
for(int i = 0; i < text.length(); i++){
fmt.format("%c ",text.charAt(i));
System.out.print(fmt);
}
System.out.println();
//searching a position index in alphabet
for(int i = 0; i < text.length(); i++){
fmt.format("%02d ",russianAlphabet.indexOf(text.charAt(i)));
System.out.print(fmt);
}
}
I just need nice compact output of two strokes, one under the other. First shows chars split-ted by space, second shows position of char in alphabet. What is wrong with format output? It returns a lot of random text. (Very sorry for bad English).
Save your program file as UTF-8. Try this code below.
I don't think you were printing the right thing here.
System.out.print(fmt);
Also note that in your program you typed some of your chars
as latin not as cyrillic (the first c for example was latin).
public class Test33 {
public static void main(String[] args) {
String russianAlphabet = " абвгдеёжзийклмнопрстуфхцчшщъыьэюя";
String text = "с точки зрения банальной эрудиции, каждый индивидуум вышедший из сферы эмбрионального развития " +
"не способен патологически идеализировать метаморфические абстракции";
for(int i = 0; i < text.length(); i++){
System.out.print(String.format("%3c | ",text.charAt(i)));
}
System.out.println();
for(int i = 0; i < text.length(); i++){
System.out.print(String.format("%3d | ",russianAlphabet.indexOf(text.charAt(i))));
}
System.out.println();
}
}
OUTPUT:
с | | т | о | ч | к | и | | з | р | е | н | и | я | | б | а | н | а | л | ь | н | о | й | | э | р | у | д | и | ц | и | и | , | | к | а | ж | д | ы | й | | и | н | д | и | в | и | д | у | у | м | | в | ы | ш | е | д | ш | и | й | | и | з | | с | ф | е | р | ы | | э | м | б | р | и | о | н | а | л | ь | н | о | г | о | | р | а | з | в | и | т | и | я | | н | е | | с | п | о | с | о | б | е | н | | п | а | т | о | л | о | г | и | ч | е | с | к | и | | и | д | е | а | л | и | з | и | р | о | в | а | т | ь | | м | е | т | а | м | о | р | ф | и | ч | е | с | к | и | е | | а | б | с | т | р | а | к | ц | и | и |
19 | 0 | 20 | 16 | 25 | 12 | 10 | 0 | 9 | 18 | 6 | 15 | 10 | 33 | 0 | 2 | 1 | 15 | 1 | 13 | 30 | 15 | 16 | 11 | 0 | 31 | 18 | 21 | 5 | 10 | 24 | 10 | 10 | -1 | 0 | 12 | 1 | 8 | 5 | 29 | 11 | 0 | 10 | 15 | 5 | 10 | 3 | 10 | 5 | 21 | 21 | 14 | 0 | 3 | 29 | 26 | 6 | 5 | 26 | 10 | 11 | 0 | 10 | 9 | 0 | 19 | 22 | 6 | 18 | 29 | 0 | 31 | 14 | 2 | 18 | 10 | 16 | 15 | 1 | 13 | 30 | 15 | 16 | 4 | 16 | 0 | 18 | 1 | 9 | 3 | 10 | 20 | 10 | 33 | 0 | 15 | 6 | 0 | 19 | 17 | 16 | 19 | 16 | 2 | 6 | 15 | 0 | 17 | 1 | 20 | 16 | 13 | 16 | 4 | 10 | 25 | 6 | 19 | 12 | 10 | 0 | 10 | 5 | 6 | 1 | 13 | 10 | 9 | 10 | 18 | 16 | 3 | 1 | 20 | 30 | 0 | 14 | 6 | 20 | 1 | 14 | 16 | 18 | 22 | 10 | 25 | 6 | 19 | 12 | 10 | 6 | 0 | 1 | 2 | 19 | 20 | 18 | 1 | 12 | 24 | 10 | 10 |