Really, really long question.
import java.io.PrintWriter; import java.util.Scanner; /** * * @author Sanchit M. Bhatnagar * @see http://uhunt.felix-halim.net/id/74004 * */ public class P12577 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); String line; int count = 1; while ((line = sc.next()) != null) { if (line.trim().equals("*")) break; out.print("Case " + count + ": "); if (line.equals("Hajj")) { out.println("Hajj-e-Akbar"); } else { out.println("Hajj-e-Asghar"); } count++; } out.close(); sc.close(); } }