WeixiangYan/CodeTransOcean huggingface dataset:
Task: Multiplication tables




Go: package main

import (
    "fmt"
)

func main() {
    fmt.Print(" x |")
    for i := 1; i <= 12; i++ {
        fmt.Printf("%4d", i)
    }
    fmt.Print("\n---+")
    for i := 1; i <= 12; i++ {
        fmt.Print("----")
    }
    for j := 1; j <= 12; j++ {
        fmt.Printf("\n%2d |", j)
        for i := 1; i <= 12; i++ {
            if i >= j {
                fmt.Printf("%4d", i*j)
            } else {
                fmt.Print("    ")
            }
        }
    }
    fmt.Println("")
}






COBOL:        identification division.
       program-id. multiplication-table.

       environment division.
       configuration section.
       repository.
           function all intrinsic.

       data division.
       working-storage section.
       01 multiplication.
          05 rows occurs 12 times.
             10 colm occurs 12 times.
                15 num    pic 999.
       77 cand pic 99.
       77 ier  pic 99.
       77 ind  pic z9.
       77 show pic zz9.

       procedure division.
       sample-main.
       perform varying cand from 1 by 1 until cand greater than 12
                  after ier from 1 by 1 until ier greater than 12
           multiply cand by ier giving num(cand, ier)
       end-perform

       perform varying cand from 1 by 1 until cand greater than 12
           move cand to ind
           display "x " ind "| " with no advancing
           perform varying ier from 1 by 1 until ier greater than 12
               if ier greater than or equal to cand then
                   move num(cand, ier) to show
                   display show with no advancing
                   if ier equal to 12 then
                       display "|"
                   else
                       display space with no advancing
                   end-if
               else
                   display "    " with no advancing
               end-if
           end-perform
       end-perform

       goback.
       end program multiplication-table.
Task: Comma quibbling



C#: using System;
using System.Linq;

namespace CommaQuibbling
{
    internal static class Program
    {
        #region Static Members
	private static string Quibble(string[] input)
	{
            return
                String.Format("{{{0}}}",
                    String.Join("",
                        input.Reverse().Zip(
                            new [] { "", " and " }.Concat(Enumerable.Repeat(", ", int.MaxValue)),
                            (x, y) => x + y).Reverse()));
	}


        private static void Main()
        {
            Console.WriteLine( Quibble( new string[] {} ) );
            Console.WriteLine( Quibble( new[] {"ABC"} ) );
            Console.WriteLine( Quibble( new[] {"ABC", "DEF"} ) );
            Console.WriteLine( Quibble( new[] {"ABC", "DEF", "G", "H"} ) );

            Console.WriteLine( "< Press Any Key >" );
            Console.ReadKey();
        }

        #endregion
    }
}









Ada: with Ada.Text_IO, Ada.Command_Line; use Ada.Command_Line;

procedure Comma_Quibble is
   
begin
   case Argument_Count is
      when 0 => Ada.Text_IO.Put_Line("{}");
      when 1 => Ada.Text_IO.Put_Line("{" & Argument(1) & "}");
      when others => 
	 Ada.Text_IO.Put("{");
	 for I in 1 .. Argument_Count-2 loop
	    Ada.Text_IO.Put(Argument(I) & ", ");
	 end loop;
	 Ada.Text_IO.Put(Argument(Argument_Count-1) & " and " &
		         Argument(Argument_Count) & "}");
   end case;
end Comma_Quibble;
Task: Comma quibbling

C: #include <stdio.h>
#include <string.h>
#include <stdlib.h>

char *quib(const char **strs, size_t size)
{

    size_t len = 3 + ((size > 1) ? (2 * size + 1) : 0);
    size_t i;

    for (i = 0; i < size; i++)
        len += strlen(strs[i]);

    char *s = malloc(len * sizeof(*s));
    if (!s)
    {
        perror("Can't allocate memory!\n");
        exit(EXIT_FAILURE);
    }

    strcpy(s, "{");
    switch (size) {
        case 0:  break;
        case 1:  strcat(s, strs[0]);
                 break;
        default: for (i = 0; i < size - 1; i++)
                 {
                     strcat(s, strs[i]);
                     if (i < size - 2)
                         strcat(s, ", ");
                     else
                         strcat(s, " and ");
                 }
                 strcat(s, strs[i]);
                 break;
    }  
    strcat(s, "}");
    return s;
}

int main(void)
{
    const char *test[] = {"ABC", "DEF", "G", "H"};
    char *s;

    for (size_t i = 0; i < 5; i++)
    {
        s = quib(test, i);
        printf("%s\n", s);
        free(s);
    }
    return EXIT_SUCCESS;
}











Ada: with Ada.Text_IO, Ada.Command_Line; use Ada.Command_Line;

procedure Comma_Quibble is
   
begin
   case Argument_Count is
      when 0 => Ada.Text_IO.Put_Line("{}");
      when 1 => Ada.Text_IO.Put_Line("{" & Argument(1) & "}");
      when others => 
	 Ada.Text_IO.Put("{");
	 for I in 1 .. Argument_Count-2 loop
	    Ada.Text_IO.Put(Argument(I) & ", ");
	 end loop;
	 Ada.Text_IO.Put(Argument(Argument_Count-1) & " and " &
		         Argument(Argument_Count) & "}");
   end case;
end Comma_Quibble;
Task: Comma quibbling


C++: #include <iostream>

template<class T>
void quibble(std::ostream& o, T i, T e) {
  o << "{";
  if (e != i) {
    T n = i++;
    const char* more = "";
    while (e != i) {
      o << more << *n;
      more = ", ";
      n = i++;
    }
    o << (*more?" and ":"") << *n;
  }
  o << "}";
}

int main(int argc, char** argv) {
  char const* a[] = {"ABC","DEF","G","H"};
  for (int i=0; i<5; i++) {
    quibble(std::cout, a, a+i);
    std::cout << std::endl;
  }
  return 0;
}










Ada: with Ada.Text_IO, Ada.Command_Line; use Ada.Command_Line;

procedure Comma_Quibble is
   
begin
   case Argument_Count is
      when 0 => Ada.Text_IO.Put_Line("{}");
      when 1 => Ada.Text_IO.Put_Line("{" & Argument(1) & "}");
      when others => 
	 Ada.Text_IO.Put("{");
	 for I in 1 .. Argument_Count-2 loop
	    Ada.Text_IO.Put(Argument(I) & ", ");
	 end loop;
	 Ada.Text_IO.Put(Argument(Argument_Count-1) & " and " &
		         Argument(Argument_Count) & "}");
   end case;
end Comma_Quibble;
Task: Comma quibbling




Go: package main

import (
    "fmt"
    "strings"
)

func q(s []string) string {
    switch len(s) {
    case 0:
        return "{}"
    case 1:
        return "{" + s[0] + "}"
    case 2:
        return "{" + s[0] + " and " + s[1] + "}"
    default:
        return "{" +
            strings.Join(s[:len(s)-1], ", ") +
            " and " +
            s[len(s)-1] +
            "}"
    }
}

func main() {
    fmt.Println(q([]string{}))
    fmt.Println(q([]string{"ABC"}))
    fmt.Println(q([]string{"ABC", "DEF"}))
    fmt.Println(q([]string{"ABC", "DEF", "G", "H"}))
}








Ada: with Ada.Text_IO, Ada.Command_Line; use Ada.Command_Line;

procedure Comma_Quibble is
   
begin
   case Argument_Count is
      when 0 => Ada.Text_IO.Put_Line("{}");
      when 1 => Ada.Text_IO.Put_Line("{" & Argument(1) & "}");
      when others => 
	 Ada.Text_IO.Put("{");
	 for I in 1 .. Argument_Count-2 loop
	    Ada.Text_IO.Put(Argument(I) & ", ");
	 end loop;
	 Ada.Text_IO.Put(Argument(Argument_Count-1) & " and " &
		         Argument(Argument_Count) & "}");
   end case;
end Comma_Quibble;
Task: Comma quibbling





Java: public class Quibbler {

	public static String quibble(String[] words) {
		String qText = "{";
		for(int wIndex = 0; wIndex < words.length; wIndex++) {
			qText += words[wIndex] + (wIndex == words.length-1 ? "" : 
						  wIndex == words.length-2 ? " and " :
						  ", ";
		}
		qText += "}";
		return qText;
	}
	
	public static void main(String[] args) {
		System.out.println(quibble(new String[]{}));
		System.out.println(quibble(new String[]{"ABC"}));
		System.out.println(quibble(new String[]{"ABC", "DEF"}));
		System.out.println(quibble(new String[]{"ABC", "DEF", "G"}));
		System.out.println(quibble(new String[]{"ABC", "DEF", "G", "H"}));
	}
}







Ada: with Ada.Text_IO, Ada.Command_Line; use Ada.Command_Line;

procedure Comma_Quibble is
   
begin
   case Argument_Count is
      when 0 => Ada.Text_IO.Put_Line("{}");
      when 1 => Ada.Text_IO.Put_Line("{" & Argument(1) & "}");
      when others => 
	 Ada.Text_IO.Put("{");
	 for I in 1 .. Argument_Count-2 loop
	    Ada.Text_IO.Put(Argument(I) & ", ");
	 end loop;
	 Ada.Text_IO.Put(Argument(Argument_Count-1) & " and " &
		         Argument(Argument_Count) & "}");
   end case;
end Comma_Quibble;
Task: Comma quibbling







Python: fun quibble(s):
    let result = s.join(' and ').replace(|| and ||, ", ", length(s) - 1)
    return "{ $result }"

let s = [
    []
    ["ABC"]
    ["ABC", "DEF"]
    ["ABC", "DEF", "G", "H"]
]

for i in s:
    print(quibble i)





Ada: with Ada.Text_IO, Ada.Command_Line; use Ada.Command_Line;

procedure Comma_Quibble is
   
begin
   case Argument_Count is
      when 0 => Ada.Text_IO.Put_Line("{}");
      when 1 => Ada.Text_IO.Put_Line("{" & Argument(1) & "}");
      when others => 
	 Ada.Text_IO.Put("{");
	 for I in 1 .. Argument_Count-2 loop
	    Ada.Text_IO.Put(Argument(I) & ", ");
	 end loop;
	 Ada.Text_IO.Put(Argument(Argument_Count-1) & " and " &
		         Argument(Argument_Count) & "}");
   end case;
end Comma_Quibble;
Task: Comma quibbling








VB: Option Explicit

Sub Main()
   Debug.Print Quibbling("")
   Debug.Print Quibbling("ABC")
   Debug.Print Quibbling("ABC, DEF")
   Debug.Print Quibbling("ABC, DEF, G, H")
   Debug.Print Quibbling("ABC, DEF, G, H, IJKLM, NO, PQRSTUV")
End Sub

Private Function Quibbling(MyString As String) As String
Dim s As String, n As Integer
   s = "{" & MyString & "}": n = InStrRev(s, ",")
   If n > 0 Then s = Left(s, n - 1) & " and " & Right(s, Len(s) - (n + 1))
   Quibbling = s
End Function




Ada: with Ada.Text_IO, Ada.Command_Line; use Ada.Command_Line;

procedure Comma_Quibble is
   
begin
   case Argument_Count is
      when 0 => Ada.Text_IO.Put_Line("{}");
      when 1 => Ada.Text_IO.Put_Line("{" & Argument(1) & "}");
      when others => 
	 Ada.Text_IO.Put("{");
	 for I in 1 .. Argument_Count-2 loop
	    Ada.Text_IO.Put(Argument(I) & ", ");
	 end loop;
	 Ada.Text_IO.Put(Argument(Argument_Count-1) & " and " &
		         Argument(Argument_Count) & "}");
   end case;
end Comma_Quibble;
Task: Comma quibbling

C: #include <stdio.h>
#include <string.h>
#include <stdlib.h>

char *quib(const char **strs, size_t size)
{

    size_t len = 3 + ((size > 1) ? (2 * size + 1) : 0);
    size_t i;

    for (i = 0; i < size; i++)
        len += strlen(strs[i]);

    char *s = malloc(len * sizeof(*s));
    if (!s)
    {
        perror("Can't allocate memory!\n");
        exit(EXIT_FAILURE);
    }

    strcpy(s, "{");
    switch (size) {
        case 0:  break;
        case 1:  strcat(s, strs[0]);
                 break;
        default: for (i = 0; i < size - 1; i++)
                 {
                     strcat(s, strs[i]);
                     if (i < size - 2)
                         strcat(s, ", ");
                     else
                         strcat(s, " and ");
                 }
                 strcat(s, strs[i]);
                 break;
    }  
    strcat(s, "}");
    return s;
}

int main(void)
{
    const char *test[] = {"ABC", "DEF", "G", "H"};
    char *s;

    for (size_t i = 0; i < 5; i++)
    {
        s = quib(test, i);
        printf("%s\n", s);
        free(s);
    }
    return EXIT_SUCCESS;
}
Task: Comma quibbling



C#: using System;
using System.Linq;

namespace CommaQuibbling
{
    internal static class Program
    {
        #region Static Members
	private static string Quibble(string[] input)
	{
            return
                String.Format("{{{0}}}",
                    String.Join("",
                        input.Reverse().Zip(
                            new [] { "", " and " }.Concat(Enumerable.Repeat(", ", int.MaxValue)),
                            (x, y) => x + y).Reverse()));
	}


        private static void Main()
        {
            Console.WriteLine( Quibble( new string[] {} ) );
            Console.WriteLine( Quibble( new[] {"ABC"} ) );
            Console.WriteLine( Quibble( new[] {"ABC", "DEF"} ) );
            Console.WriteLine( Quibble( new[] {"ABC", "DEF", "G", "H"} ) );

            Console.WriteLine( "< Press Any Key >" );
            Console.ReadKey();
        }

        #endregion
    }
}
Task: Comma quibbling


C++: #include <iostream>

template<class T>
void quibble(std::ostream& o, T i, T e) {
  o << "{";
  if (e != i) {
    T n = i++;
    const char* more = "";
    while (e != i) {
      o << more << *n;
      more = ", ";
      n = i++;
    }
    o << (*more?" and ":"") << *n;
  }
  o << "}";
}

int main(int argc, char** argv) {
  char const* a[] = {"ABC","DEF","G","H"};
  for (int i=0; i<5; i++) {
    quibble(std::cout, a, a+i);
    std::cout << std::endl;
  }
  return 0;
}
Task: Comma quibbling





Java: public class Quibbler {

	public static String quibble(String[] words) {
		String qText = "{";
		for(int wIndex = 0; wIndex < words.length; wIndex++) {
			qText += words[wIndex] + (wIndex == words.length-1 ? "" : 
						  wIndex == words.length-2 ? " and " :
						  ", ";
		}
		qText += "}";
		return qText;
	}
	
	public static void main(String[] args) {
		System.out.println(quibble(new String[]{}));
		System.out.println(quibble(new String[]{"ABC"}));
		System.out.println(quibble(new String[]{"ABC", "DEF"}));
		System.out.println(quibble(new String[]{"ABC", "DEF", "G"}));
		System.out.println(quibble(new String[]{"ABC", "DEF", "G", "H"}));
	}
}
Task: Comma quibbling







Python: fun quibble(s):
    let result = s.join(' and ').replace(|| and ||, ", ", length(s) - 1)
    return "{ $result }"

let s = [
    []
    ["ABC"]
    ["ABC", "DEF"]
    ["ABC", "DEF", "G", "H"]
]

for i in s:
    print(quibble i)
Task: Comma quibbling








VB: Option Explicit

Sub Main()
   Debug.Print Quibbling("")
   Debug.Print Quibbling("ABC")
   Debug.Print Quibbling("ABC, DEF")
   Debug.Print Quibbling("ABC, DEF, G, H")
   Debug.Print Quibbling("ABC, DEF, G, H, IJKLM, NO, PQRSTUV")
End Sub

Private Function Quibbling(MyString As String) As String
Dim s As String, n As Integer
   s = "{" & MyString & "}": n = InStrRev(s, ",")
   If n > 0 Then s = Left(s, n - 1) & " and " & Right(s, Len(s) - (n + 1))
   Quibbling = s
End Function
Task: Comma quibbling




Go: package main

import (
    "fmt"
    "strings"
)

func q(s []string) string {
    switch len(s) {
    case 0:
        return "{}"
    case 1:
        return "{" + s[0] + "}"
    case 2:
        return "{" + s[0] + " and " + s[1] + "}"
    default:
        return "{" +
            strings.Join(s[:len(s)-1], ", ") +
            " and " +
            s[len(s)-1] +
            "}"
    }
}

func main() {
    fmt.Println(q([]string{}))
    fmt.Println(q([]string{"ABC"}))
    fmt.Println(q([]string{"ABC", "DEF"}))
    fmt.Println(q([]string{"ABC", "DEF", "G", "H"}))
}
Task: Comma quibbling



C#: using System;
using System.Linq;

namespace CommaQuibbling
{
    internal static class Program
    {
        #region Static Members
	private static string Quibble(string[] input)
	{
            return
                String.Format("{{{0}}}",
                    String.Join("",
                        input.Reverse().Zip(
                            new [] { "", " and " }.Concat(Enumerable.Repeat(", ", int.MaxValue)),
                            (x, y) => x + y).Reverse()));
	}


        private static void Main()
        {
            Console.WriteLine( Quibble( new string[] {} ) );
            Console.WriteLine( Quibble( new[] {"ABC"} ) );
            Console.WriteLine( Quibble( new[] {"ABC", "DEF"} ) );
            Console.WriteLine( Quibble( new[] {"ABC", "DEF", "G", "H"} ) );

            Console.WriteLine( "< Press Any Key >" );
            Console.ReadKey();
        }

        #endregion
    }
}








Fortran:       SUBROUTINE QUIBBLE(TEXT,OXFORDIAN)	
       CHARACTER*(*) TEXT	
       LOGICAL OXFORDIAN	
       INTEGER IST(6),LST(6)	
       INTEGER N,L,I		
       INTEGER L1,L2		
       INTEGER MSG		
       COMMON /IODEV/MSG	
Chop the text into words.
        N = 0		
        L = LEN(TEXT)	
        L2 = 0		
   10   L1 = L2		
   11   L1 = L1 + 1		
        IF (L1.GT.L) GO TO 20		
        IF (TEXT(L1:L1).LE." ") GO TO 11	
        L2 = L1			
   12   L2 = L2 + 1		
        IF (L2.GT.L) GO TO 13	
        IF (TEXT(L2:L2).GT." ") GO TO 12	
   13   N = N + 1			
        IST(N) = L1		
        LST(N) = L2 - 1		
        IF (L2.LT.L) GO TO 10	
Comma time...
   20   WRITE (MSG,21) "{"	
   21   FORMAT (A,$)		
        DO I = 1,N		
          IF (I.GT.1) THEN		
            IF (I.LT.N) THEN			
              WRITE (MSG,21) ", "			
            ELSE IF (OXFORDIAN) THEN		
              WRITE (MSG,21) ", and "			
            ELSE				
              WRITE (MSG,21) " and "			
            END IF				
          END IF			
          WRITE (MSG,21) TEXT(IST(I):LST(I))	
        END DO			
        WRITE (MSG,"('}')")	
      END		

      PROGRAM ENCOMMA	
      CHARACTER*(666) TEXT	
      INTEGER KBD,MSG,INF	
      COMMON /IODEV/MSG,KBD	
      KBD = 5	
      MSG = 6	
      INF = 10	
      OPEN (INF,FILE="List.txt",ACTION = "READ")	

   10 WRITE (MSG,11) "To insert commas into lists..."	
   11 FORMAT (A)			
   12 READ (INF,11,END = 20) TEXT	
      CALL QUIBBLE(TEXT,.FALSE.)	
      GO TO 12				

   20 REWIND (INF)			
      WRITE (MSG,11)			
      WRITE (MSG,11) "Oxford style..."	
   21 READ (INF,11,END = 30) TEXT	
      CALL QUIBBLE(TEXT,.TRUE.)		
      GO TO 21				

Closedown
   30 END
Task: Comma quibbling


C++: #include <iostream>

template<class T>
void quibble(std::ostream& o, T i, T e) {
  o << "{";
  if (e != i) {
    T n = i++;
    const char* more = "";
    while (e != i) {
      o << more << *n;
      more = ", ";
      n = i++;
    }
    o << (*more?" and ":"") << *n;
  }
  o << "}";
}

int main(int argc, char** argv) {
  char const* a[] = {"ABC","DEF","G","H"};
  for (int i=0; i<5; i++) {
    quibble(std::cout, a, a+i);
    std::cout << std::endl;
  }
  return 0;
}









Fortran:       SUBROUTINE QUIBBLE(TEXT,OXFORDIAN)	
       CHARACTER*(*) TEXT	
       LOGICAL OXFORDIAN	
       INTEGER IST(6),LST(6)	
       INTEGER N,L,I		
       INTEGER L1,L2		
       INTEGER MSG		
       COMMON /IODEV/MSG	
Chop the text into words.
        N = 0		
        L = LEN(TEXT)	
        L2 = 0		
   10   L1 = L2		
   11   L1 = L1 + 1		
        IF (L1.GT.L) GO TO 20		
        IF (TEXT(L1:L1).LE." ") GO TO 11	
        L2 = L1			
   12   L2 = L2 + 1		
        IF (L2.GT.L) GO TO 13	
        IF (TEXT(L2:L2).GT." ") GO TO 12	
   13   N = N + 1			
        IST(N) = L1		
        LST(N) = L2 - 1		
        IF (L2.LT.L) GO TO 10	
Comma time...
   20   WRITE (MSG,21) "{"	
   21   FORMAT (A,$)		
        DO I = 1,N		
          IF (I.GT.1) THEN		
            IF (I.LT.N) THEN			
              WRITE (MSG,21) ", "			
            ELSE IF (OXFORDIAN) THEN		
              WRITE (MSG,21) ", and "			
            ELSE				
              WRITE (MSG,21) " and "			
            END IF				
          END IF			
          WRITE (MSG,21) TEXT(IST(I):LST(I))	
        END DO			
        WRITE (MSG,"('}')")	
      END		

      PROGRAM ENCOMMA	
      CHARACTER*(666) TEXT	
      INTEGER KBD,MSG,INF	
      COMMON /IODEV/MSG,KBD	
      KBD = 5	
      MSG = 6	
      INF = 10	
      OPEN (INF,FILE="List.txt",ACTION = "READ")	

   10 WRITE (MSG,11) "To insert commas into lists..."	
   11 FORMAT (A)			
   12 READ (INF,11,END = 20) TEXT	
      CALL QUIBBLE(TEXT,.FALSE.)	
      GO TO 12				

   20 REWIND (INF)			
      WRITE (MSG,11)			
      WRITE (MSG,11) "Oxford style..."	
   21 READ (INF,11,END = 30) TEXT	
      CALL QUIBBLE(TEXT,.TRUE.)		
      GO TO 21				

Closedown
   30 END
Task: Comma quibbling

C: #include <stdio.h>
#include <string.h>
#include <stdlib.h>

char *quib(const char **strs, size_t size)
{

    size_t len = 3 + ((size > 1) ? (2 * size + 1) : 0);
    size_t i;

    for (i = 0; i < size; i++)
        len += strlen(strs[i]);

    char *s = malloc(len * sizeof(*s));
    if (!s)
    {
        perror("Can't allocate memory!\n");
        exit(EXIT_FAILURE);
    }

    strcpy(s, "{");
    switch (size) {
        case 0:  break;
        case 1:  strcat(s, strs[0]);
                 break;
        default: for (i = 0; i < size - 1; i++)
                 {
                     strcat(s, strs[i]);
                     if (i < size - 2)
                         strcat(s, ", ");
                     else
                         strcat(s, " and ");
                 }
                 strcat(s, strs[i]);
                 break;
    }  
    strcat(s, "}");
    return s;
}

int main(void)
{
    const char *test[] = {"ABC", "DEF", "G", "H"};
    char *s;

    for (size_t i = 0; i < 5; i++)
    {
        s = quib(test, i);
        printf("%s\n", s);
        free(s);
    }
    return EXIT_SUCCESS;
}










Fortran:       SUBROUTINE QUIBBLE(TEXT,OXFORDIAN)	
       CHARACTER*(*) TEXT	
       LOGICAL OXFORDIAN	
       INTEGER IST(6),LST(6)	
       INTEGER N,L,I		
       INTEGER L1,L2		
       INTEGER MSG		
       COMMON /IODEV/MSG	
Chop the text into words.
        N = 0		
        L = LEN(TEXT)	
        L2 = 0		
   10   L1 = L2		
   11   L1 = L1 + 1		
        IF (L1.GT.L) GO TO 20		
        IF (TEXT(L1:L1).LE." ") GO TO 11	
        L2 = L1			
   12   L2 = L2 + 1		
        IF (L2.GT.L) GO TO 13	
        IF (TEXT(L2:L2).GT." ") GO TO 12	
   13   N = N + 1			
        IST(N) = L1		
        LST(N) = L2 - 1		
        IF (L2.LT.L) GO TO 10	
Comma time...
   20   WRITE (MSG,21) "{"	
   21   FORMAT (A,$)		
        DO I = 1,N		
          IF (I.GT.1) THEN		
            IF (I.LT.N) THEN			
              WRITE (MSG,21) ", "			
            ELSE IF (OXFORDIAN) THEN		
              WRITE (MSG,21) ", and "			
            ELSE				
              WRITE (MSG,21) " and "			
            END IF				
          END IF			
          WRITE (MSG,21) TEXT(IST(I):LST(I))	
        END DO			
        WRITE (MSG,"('}')")	
      END		

      PROGRAM ENCOMMA	
      CHARACTER*(666) TEXT	
      INTEGER KBD,MSG,INF	
      COMMON /IODEV/MSG,KBD	
      KBD = 5	
      MSG = 6	
      INF = 10	
      OPEN (INF,FILE="List.txt",ACTION = "READ")	

   10 WRITE (MSG,11) "To insert commas into lists..."	
   11 FORMAT (A)			
   12 READ (INF,11,END = 20) TEXT	
      CALL QUIBBLE(TEXT,.FALSE.)	
      GO TO 12				

   20 REWIND (INF)			
      WRITE (MSG,11)			
      WRITE (MSG,11) "Oxford style..."	
   21 READ (INF,11,END = 30) TEXT	
      CALL QUIBBLE(TEXT,.TRUE.)		
      GO TO 21				

Closedown
   30 END