fork(1) download
  1. with Ada.Text_IO;
  2. procedure Quine is
  3. use Ada.Text_IO;
  4. Q : constant Character := Character'Val (34);
  5. Data : constant String :=
  6. "with Ada.Text_IO;~procedure Quine is~ use Ada.Text_IO;~ Q : constant Character := Character'Val (34);~ Data : constant String :=~ \ procedure Nl (S : String) is~ begin~ for I in S'Range loop~ if S (I) = '~' then~ New_Line;~ else~ Put (S (I));~ end if;~ end loop;~ end Nl;~ procedure Qs (S : String) is~ begin~ Put (Q);~ for I in S'Range loop~ if S (I) = Q then~ Put (Q); Put (Q);~ else~ Put (S (I));~ end if;~ end loop;~ Put (Q);~ end Qs;~ Split : Integer := 0;~begin~ for I in Data'Range loop~ if Data (I) = '\' then~ Split := I;~ exit;~ end if;~ end loop;~ Nl (Data (Data'First .. Split - 1));~ Qs (Data);~ Put (';');~ New_Line;~ Nl (Data (Split + 1 .. Data'Last));~end Quine;~";
  7. procedure Nl (S : String) is
  8. begin
  9. for I in S'Range loop
  10. if S (I) = '~' then
  11. New_Line;
  12. else
  13. Put (S (I));
  14. end if;
  15. end loop;
  16. end Nl;
  17. procedure Qs (S : String) is
  18. begin
  19. Put (Q);
  20. for I in S'Range loop
  21. if S (I) = Q then
  22. Put (Q); Put (Q);
  23. else
  24. Put (S (I));
  25. end if;
  26. end loop;
  27. Put (Q);
  28. end Qs;
  29. Split : Integer := 0;
  30. begin
  31. for I in Data'Range loop
  32. if Data (I) = '\' then
  33. Split := I;
  34. exit;
  35. end if;
  36. end loop;
  37. Nl (Data (Data'First .. Split - 1));
  38. Qs (Data);
  39. Put (';');
  40. New_Line;
  41. Nl (Data (Split + 1 .. Data'Last));
  42. end Quine;
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
with Ada.Text_IO;
procedure Quine is
   use Ada.Text_IO;
   Q : constant Character := Character'Val (34);
   Data : constant String :=
      "with Ada.Text_IO;~procedure Quine is~   use Ada.Text_IO;~   Q : constant Character := Character'Val (34);~   Data : constant String :=~      \   procedure Nl (S : String) is~   begin~      for I in S'Range loop~         if S (I) = '~' then~            New_Line;~         else~            Put (S (I));~         end if;~      end loop;~   end Nl;~   procedure Qs (S : String) is~   begin~      Put (Q);~      for I in S'Range loop~         if S (I) = Q then~            Put (Q); Put (Q);~         else~            Put (S (I));~         end if;~      end loop;~      Put (Q);~   end Qs;~   Split : Integer := 0;~begin~   for I in Data'Range loop~      if Data (I) = '\' then~         Split := I;~         exit;~      end if;~   end loop;~   Nl (Data (Data'First .. Split - 1));~   Qs (Data);~   Put (';');~   New_Line;~   Nl (Data (Split + 1 .. Data'Last));~end Quine;~";
   procedure Nl (S : String) is
   begin
      for I in S'Range loop
         if S (I) = '
' then
            New_Line;
         else
            Put (S (I));
         end if;
      end loop;
   end Nl;
   procedure Qs (S : String) is
   begin
      Put (Q);
      for I in S'Range loop
         if S (I) = Q then
            Put (Q); Put (Q);
         else
            Put (S (I));
         end if;
      end loop;
      Put (Q);
   end Qs;
   Split : Integer := 0;
begin
   for I in Data'Range loop
      if Data (I) = '\' then
         Split := I;
         exit;
      end if;
   end loop;
   Nl (Data (Data'First .. Split - 1));
   Qs (Data);
   Put (';');
   New_Line;
   Nl (Data (Split + 1 .. Data'Last));
end Quine;