WeixiangYan/CodeTransOcean huggingface dataset:
Task: Days between dates





Java: import java.time.LocalDate;
import java.time.temporal.ChronoUnit;

public class DaysBetweenDates {
    public static void main(String[] args) {
        LocalDate fromDate = LocalDate.parse("2019-01-01");
        LocalDate toDate = LocalDate.parse("2019-10-19");
        long diff = ChronoUnit.DAYS.between(fromDate, toDate);
        System.out.printf("Number of days between %s and %s: %d\n", fromDate, toDate, diff);
    }
}



Python: 
import sys



def days( y,m,d ):
  
  m = (m + 9) % 12 
  y = y - m/10

  
  result = 365*y + y/4 - y/100 + y/400 + (m*306 + 5)/10 + ( d - 1 )
  return result

def diff(one,two):
  [y1,m1,d1] = one.split('-')
  [y2,m2,d2] = two.split('-')
  
  year2 = days( int(y2),int(m2),int(d2))
  year1 = days( int(y1), int(m1), int(d1) )
  return year2 - year1

if __name__ == "__main__":
  one = sys.argv[1]
  two = sys.argv[2]
  print diff(one,two)
Task: Days between dates




Go: package main

import (
    "fmt"
    "log"
    "time"
)

const layout = "2006-01-02" 


func daysBetween(date1, date2 string) int {
    t1, err := time.Parse(layout, date1)
    check(err)
    t2, err := time.Parse(layout, date2)
    check(err)
    days := int(t1.Sub(t2).Hours() / 24)
    if days < 0 {
        days = -days
    }
    return days
}
    
func check(err error) {
    if err != nil {
        log.Fatal(err)
    }
}

func main() {
    date1, date2 := "2019-01-01", "2019-09-30"
    days := daysBetween(date1, date2)
    fmt.Printf("There are %d days between %s and %s\n", days, date1, date2)

    date1, date2 = "2015-12-31", "2016-09-30"
    days = daysBetween(date1, date2)
    fmt.Printf("There are %d days between %s and %s\n", days, date1, date2)
}




Python: 
import sys



def days( y,m,d ):
  
  m = (m + 9) % 12 
  y = y - m/10

  
  result = 365*y + y/4 - y/100 + y/400 + (m*306 + 5)/10 + ( d - 1 )
  return result

def diff(one,two):
  [y1,m1,d1] = one.split('-')
  [y2,m2,d2] = two.split('-')
  
  year2 = days( int(y2),int(m2),int(d2))
  year1 = days( int(y1), int(m1), int(d1) )
  return year2 - year1

if __name__ == "__main__":
  one = sys.argv[1]
  two = sys.argv[2]
  print diff(one,two)
Task: Days between dates



C#: using System;
using System.Globalization;

public class Program
{
    public static void Main() => WriteLine(DateDiff("1970-01-01", "2019-10-18"));

    public static int DateDiff(string d1, string d2) {
        var a = DateTime.ParseExact(d1, "yyyy-MM-dd", CultureInfo.InvariantCulture);
        var b = DateTime.ParseExact(d2, "yyyy-MM-dd", CultureInfo.InvariantCulture);
        return (int)(b - a).TotalDays;
    }
}



Java: import java.time.LocalDate;
import java.time.temporal.ChronoUnit;

public class DaysBetweenDates {
    public static void main(String[] args) {
        LocalDate fromDate = LocalDate.parse("2019-01-01");
        LocalDate toDate = LocalDate.parse("2019-10-19");
        long diff = ChronoUnit.DAYS.between(fromDate, toDate);
        System.out.printf("Number of days between %s and %s: %d\n", fromDate, toDate, diff);
    }
}
Task: GUI enabling_disabling of controls

C: #include <windows.h>
#include "resource.h"

#define MIN_VALUE    0
#define MAX_VALUE   10

BOOL CALLBACK DlgProc( HWND hwnd, UINT msg, WPARAM wPar, LPARAM lPar );
void Increment( HWND hwnd );
void Decrement( HWND hwnd );
void SetControlsState( HWND hwnd );

int WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPInst, LPSTR cmdLn, int show ) {
    return DialogBox( hInst, MAKEINTRESOURCE(IDD_DLG), NULL, DlgProc );
}

BOOL CALLBACK DlgProc( HWND hwnd, UINT msg, WPARAM wPar, LPARAM lPar ) {
    switch( msg ) {

        case WM_INITDIALOG:
            srand( GetTickCount() );
            SetDlgItemInt( hwnd, IDC_INPUT, 0, FALSE );
            break;

        case WM_COMMAND:
            switch( LOWORD(wPar) ) {
                case IDC_INCREMENT:
                    Increment( hwnd );
                    break;
                case IDC_DECREMENT:
                    Decrement( hwnd );
                    break;
                case IDC_INPUT:
                    
                    
                    if( HIWORD(wPar) == EN_CHANGE ) SetControlsState( hwnd );
                    break;
                case IDC_QUIT:
                    SendMessage( hwnd, WM_CLOSE, 0, 0 );
                    break;
                default: ;
            }
            break;

        case WM_CLOSE: {
            int reply = MessageBox( hwnd,
                "Do you really want to quit?",
                "Quit confirmation", MB_ICONQUESTION|MB_YESNO );
            if( reply == IDYES )
                EndDialog( hwnd, 0 );
            } break;

        default: ;
    }

    return 0;
}

void Increment( HWND hwnd ) {
    UINT n = GetDlgItemInt( hwnd, IDC_INPUT, NULL, FALSE );

    if( n < MAX_VALUE ) {
        SetDlgItemInt( hwnd, IDC_INPUT, ++n, FALSE );
        SetControlsState( hwnd );
    }
}

void Decrement( HWND hwnd ) {
    UINT n = GetDlgItemInt( hwnd, IDC_INPUT, NULL, FALSE );

    if( n > MIN_VALUE ) {
        SetDlgItemInt( hwnd, IDC_INPUT, --n, FALSE );
        SetControlsState( hwnd );
    }
}

void SetControlsState( HWND hwnd ) {
    UINT n = GetDlgItemInt( hwnd, IDC_INPUT, NULL, FALSE );
    EnableWindow( GetDlgItem(hwnd,IDC_INCREMENT), n<MAX_VALUE );
    EnableWindow( GetDlgItem(hwnd,IDC_DECREMENT), n>MIN_VALUE );
}


C++: #ifndef TASK_H
#define TASK_H

#include <QWidget>

class QPushButton ;
class QString ;
class QLineEdit ;
class QLabel ;
class QVBoxLayout ;
class QHBoxLayout ;

class MyWidget : public QWidget {
    
    Q_OBJECT
public:
   MyWidget( QWidget *parent = 0 ) ;
private slots:
   void buttonChange( const QString & ) ;
   void addField( ) ;
   void subtractField( ) ;
private :
   QVBoxLayout *thisWidgetLayout ;
   QLabel *instruction ;
   QPushButton *increment ;
   QPushButton *decrement ;
   QLineEdit *entryField ;
   QHBoxLayout *lowerPart ;
} ;
#endif
Task: GUI enabling_disabling of controls


C++: #ifndef TASK_H
#define TASK_H

#include <QWidget>

class QPushButton ;
class QString ;
class QLineEdit ;
class QLabel ;
class QVBoxLayout ;
class QHBoxLayout ;

class MyWidget : public QWidget {
    
    Q_OBJECT
public:
   MyWidget( QWidget *parent = 0 ) ;
private slots:
   void buttonChange( const QString & ) ;
   void addField( ) ;
   void subtractField( ) ;
private :
   QVBoxLayout *thisWidgetLayout ;
   QLabel *instruction ;
   QPushButton *increment ;
   QPushButton *decrement ;
   QLineEdit *entryField ;
   QHBoxLayout *lowerPart ;
} ;
#endif


C#: using System; 
using System.ComponentModel; 
using System.Windows.Forms; 

class RosettaInteractionForm : Form
{    

    
    
    class NumberModel: INotifyPropertyChanged
    {
        
        public event PropertyChangedEventHandler PropertyChanged = delegate {};

        int _value;
        public int Value
        {
            get { return _value; }
            set 
            { 
                _value = value;
                
                PropertyChanged(this, new PropertyChangedEventArgs("Value"));
            }
        }
    }

    NumberModel model = new NumberModel{ Value = 0};
    
    RosettaInteractionForm()    
    {
        
        var tbNumber = new MaskedTextBox
                        { 
                            Mask="0000",            
                            ResetOnSpace = false,   
                            Dock = DockStyle.Top    
                        };
        
        tbNumber.DataBindings.Add("Text", model, "Value");
        var enabledIfZero = new Binding("Enabled", model, "Value");
        EnableControlWhen(tbNumber, value => value == 0);

        var btIncrement = new Button{Text = "Increment", Dock = DockStyle.Bottom};
        btIncrement.Click += delegate
                        {
                            model.Value++;
                        };
        EnableControlWhen(btIncrement, value => value < 10);
        var btDecrement = new Button{Text = "Decrement", Dock = DockStyle.Bottom};
        btDecrement.Click += delegate
                        {
                            model.Value--;
                        };
        EnableControlWhen(btDecrement, value => value > 0);
        Controls.Add(tbNumber);
        Controls.Add(btIncrement);
        Controls.Add(btDecrement);
    }

    
    void EnableControlWhen(Control ctrl, Func<int, bool> predicate)
    {
        
        var enabledBinding = new Binding("Enabled", model, "Value");
        
        enabledBinding.Format += (sender, args) =>
            {
                
                if (args.DesiredType != typeof(bool)) return;
                
                args.Value = predicate((int)args.Value);
            };
        
        ctrl.DataBindings.Add(enabledBinding);
    }

    static void Main()
    {
        Application.Run(new RosettaInteractionForm());
    }
}
Task: GUI enabling_disabling of controls


C++: #ifndef TASK_H
#define TASK_H

#include <QWidget>

class QPushButton ;
class QString ;
class QLineEdit ;
class QLabel ;
class QVBoxLayout ;
class QHBoxLayout ;

class MyWidget : public QWidget {
    
    Q_OBJECT
public:
   MyWidget( QWidget *parent = 0 ) ;
private slots:
   void buttonChange( const QString & ) ;
   void addField( ) ;
   void subtractField( ) ;
private :
   QVBoxLayout *thisWidgetLayout ;
   QLabel *instruction ;
   QPushButton *increment ;
   QPushButton *decrement ;
   QLineEdit *entryField ;
   QHBoxLayout *lowerPart ;
} ;
#endif







VB: VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   2265
   ClientLeft      =   60
   ClientTop       =   600
   ClientWidth     =   2175
   LinkTopic       =   "Form1"
   ScaleHeight     =   2265
   ScaleWidth      =   2175
   StartUpPosition =   3  
   Begin VB.CommandButton cmdDec 
      Caption         =   "Decrement"
      Enabled         =   0   
      Height          =   495
      Left            =   120
      TabIndex        =   2
      Top             =   1680
      Width           =   1215
   End
   Begin VB.CommandButton cmdInc 
      Caption         =   "Increment"
      Height          =   495
      Left            =   120
      TabIndex        =   1
      Top             =   1080
      Width           =   1215
   End
   Begin VB.TextBox txtValue 
      Height          =   495
      Left            =   120
      TabIndex        =   0
      Text            =   "0"
      Top             =   240
      Width           =   1215
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub cmdDec_Click()
    If Val(txtValue.Text) > 0 Then txtValue.Text = Val(txtValue.Text) - 1
End Sub

Private Sub cmdInc_Click()
    If Val(txtValue.Text) < 10 Then txtValue.Text = Val(txtValue.Text) + 1
End Sub

Private Sub txtValue_Change()
    Select Case Val(txtValue.Text)
        Case Is < 0
            txtValue.Enabled = False
            cmdInc.Enabled = True
            cmdDec.Enabled = False
        Case Is > 9
            txtValue.Enabled = False
            cmdInc.Enabled = False
            cmdDec.Enabled = True
        Case 0
            txtValue.Enabled = True
            cmdInc.Enabled = True
            cmdDec.Enabled = False
        Case Else
            txtValue.Enabled = False
            cmdInc.Enabled = True
            cmdDec.Enabled = True
    End Select
End Sub
Task: Sort the letters of string in alphabetical order

C: #include <stdio.h>


void strsort(char *s) {
    unsigned int n[256] = {0};
    unsigned char i = 0;
    char *t = s;
    while (*s) ++n[(unsigned char) *s++];
    while (++i) while (n[i]--) *t++ = (char) i;
}

int main() {
    char s[] = "Now is the time for all good men "
               "to come to the aid of their country.";
    puts(s);
    strsort(s);
    puts(s);
    return 0;
}



C#: using System; using static System.Console;
class Program {
  static void Main(string[] args) {
    var nl = "\n";
    var omit_spaces = true;
    var str = "forever ring programming language";
    Write( "working..." + nl );
    Write( "Sort the letters of string in alphabitical order:" + nl );
    Write( "Input: " + str + nl );
    Write( "Output: " );
    for (var ch = omit_spaces ? 33 : 0; ch < 256; ch++)
      foreach (var itm in str)
        if (ch == itm) Console.Write(itm);
    Write( nl + "done..." );
  }
}
Task: Sort the letters of string in alphabetical order

C: #include <stdio.h>


void strsort(char *s) {
    unsigned int n[256] = {0};
    unsigned char i = 0;
    char *t = s;
    while (*s) ++n[(unsigned char) *s++];
    while (++i) while (n[i]--) *t++ = (char) i;
}

int main() {
    char s[] = "Now is the time for all good men "
               "to come to the aid of their country.";
    puts(s);
    strsort(s);
    puts(s);
    return 0;
}




Go: package main

import (
    "fmt"
    "strings"
)

func bubbleSort(s string, trim bool) string { 
    chars := []rune(s)
    n := len(chars)
    for {
        n2 := 0
        for i := 1; i < n; i++ {
            if chars[i-1] > chars[i] {
                tmp := chars[i]
                chars[i] = chars[i-1]
                chars[i-1] = tmp
                n2 = i
            }
        }
        n = n2
        if n == 0 {
            break
        }
    }
    s = string(chars)
    if trim {
        s = strings.TrimLeft(s, " \t\r\n")
    }
    return s
}

func main() {
    ss := []string{
        "forever go programming language",
        "Now is the time for all good men to come to the aid of their country.",
    }
    trims := []bool{true, false}
    for i, s := range ss {
        res := bubbleSort(s, trims[i])
        fmt.Printf("Unsorted->%s\n", s)
        fmt.Printf("Sorted  ->%s\n\n", res)
    }
}
Task: Sort the letters of string in alphabetical order

C: #include <stdio.h>


void strsort(char *s) {
    unsigned int n[256] = {0};
    unsigned char i = 0;
    char *t = s;
    while (*s) ++n[(unsigned char) *s++];
    while (++i) while (n[i]--) *t++ = (char) i;
}

int main() {
    char s[] = "Now is the time for all good men "
               "to come to the aid of their country.";
    puts(s);
    strsort(s);
    puts(s);
    return 0;
}







Python: 

from functools import reduce



def qSort(xs):
    
    if xs:
        h = xs[0]
        below, above = partition(
            lambda v: v <= h
        )(xs[1:])

        return qSort(below) + [h] + qSort(above)
    else:
        return []



def main():
    
    print(quoted('"')(
        ''.join(qSort(list(
            "Is this misspelling of alphabetical as alphabitical a joke ?"
        )))
    ))





def partition(p):
    
    def go(a, x):
        ts, fs = a
        return (ts + [x], fs) if p(x) else (ts, fs + [x])
    return lambda xs: reduce(go, xs, ([], []))



def quoted(c):
    
    return lambda s: c + s + c



if __name__ == '__main__':
    main()
Task: Sort the letters of string in alphabetical order

C: #include <stdio.h>


void strsort(char *s) {
    unsigned int n[256] = {0};
    unsigned char i = 0;
    char *t = s;
    while (*s) ++n[(unsigned char) *s++];
    while (++i) while (n[i]--) *t++ = (char) i;
}

int main() {
    char s[] = "Now is the time for all good men "
               "to come to the aid of their country.";
    puts(s);
    strsort(s);
    puts(s);
    return 0;
}








VB: sub bubble(arr)
  n = UBound(arr)
  Do
    nn = -1
    For j = 0 to n - 1
        If arr(j) > arr(j + 1) Then
            temp= arr(j):arr(j)=arr(j+1):arr(j+1)=temp
           nn = j
        End If
    Next
    n = nn
  Loop Until nn = -1
end sub


s="The quick brown fox jumps over the lazy dog, apparently"
redim a(len(s)-1)
for i=1 to len(s)
   a(i-1)=mid(s,i,1)
next
bubble a
s1=join(a,"")
wscript.echo s1
Task: Sort the letters of string in alphabetical order



C#: using System; using static System.Console;
class Program {
  static void Main(string[] args) {
    var nl = "\n";
    var omit_spaces = true;
    var str = "forever ring programming language";
    Write( "working..." + nl );
    Write( "Sort the letters of string in alphabitical order:" + nl );
    Write( "Input: " + str + nl );
    Write( "Output: " );
    for (var ch = omit_spaces ? 33 : 0; ch < 256; ch++)
      foreach (var itm in str)
        if (ch == itm) Console.Write(itm);
    Write( nl + "done..." );
  }
}


Go: package main

import (
    "fmt"
    "strings"
)

func bubbleSort(s string, trim bool) string { 
    chars := []rune(s)
    n := len(chars)
    for {
        n2 := 0
        for i := 1; i < n; i++ {
            if chars[i-1] > chars[i] {
                tmp := chars[i]
                chars[i] = chars[i-1]
                chars[i-1] = tmp
                n2 = i
            }
        }
        n = n2
        if n == 0 {
            break
        }
    }
    s = string(chars)
    if trim {
        s = strings.TrimLeft(s, " \t\r\n")
    }
    return s
}

func main() {
    ss := []string{
        "forever go programming language",
        "Now is the time for all good men to come to the aid of their country.",
    }
    trims := []bool{true, false}
    for i, s := range ss {
        res := bubbleSort(s, trims[i])
        fmt.Printf("Unsorted->%s\n", s)
        fmt.Printf("Sorted  ->%s\n\n", res)
    }
}
Task: Sort the letters of string in alphabetical order



C#: using System; using static System.Console;
class Program {
  static void Main(string[] args) {
    var nl = "\n";
    var omit_spaces = true;
    var str = "forever ring programming language";
    Write( "working..." + nl );
    Write( "Sort the letters of string in alphabitical order:" + nl );
    Write( "Input: " + str + nl );
    Write( "Output: " );
    for (var ch = omit_spaces ? 33 : 0; ch < 256; ch++)
      foreach (var itm in str)
        if (ch == itm) Console.Write(itm);
    Write( nl + "done..." );
  }
}





Python: 

from functools import reduce



def qSort(xs):
    
    if xs:
        h = xs[0]
        below, above = partition(
            lambda v: v <= h
        )(xs[1:])

        return qSort(below) + [h] + qSort(above)
    else:
        return []



def main():
    
    print(quoted('"')(
        ''.join(qSort(list(
            "Is this misspelling of alphabetical as alphabitical a joke ?"
        )))
    ))





def partition(p):
    
    def go(a, x):
        ts, fs = a
        return (ts + [x], fs) if p(x) else (ts, fs + [x])
    return lambda xs: reduce(go, xs, ([], []))



def quoted(c):
    
    return lambda s: c + s + c



if __name__ == '__main__':
    main()
Task: Sort the letters of string in alphabetical order



C#: using System; using static System.Console;
class Program {
  static void Main(string[] args) {
    var nl = "\n";
    var omit_spaces = true;
    var str = "forever ring programming language";
    Write( "working..." + nl );
    Write( "Sort the letters of string in alphabitical order:" + nl );
    Write( "Input: " + str + nl );
    Write( "Output: " );
    for (var ch = omit_spaces ? 33 : 0; ch < 256; ch++)
      foreach (var itm in str)
        if (ch == itm) Console.Write(itm);
    Write( nl + "done..." );
  }
}






VB: sub bubble(arr)
  n = UBound(arr)
  Do
    nn = -1
    For j = 0 to n - 1
        If arr(j) > arr(j + 1) Then
            temp= arr(j):arr(j)=arr(j+1):arr(j+1)=temp
           nn = j
        End If
    Next
    n = nn
  Loop Until nn = -1
end sub


s="The quick brown fox jumps over the lazy dog, apparently"
redim a(len(s)-1)
for i=1 to len(s)
   a(i-1)=mid(s,i,1)
next
bubble a
s1=join(a,"")
wscript.echo s1
Task: Sort the letters of string in alphabetical order




Go: package main

import (
    "fmt"
    "strings"
)

func bubbleSort(s string, trim bool) string { 
    chars := []rune(s)
    n := len(chars)
    for {
        n2 := 0
        for i := 1; i < n; i++ {
            if chars[i-1] > chars[i] {
                tmp := chars[i]
                chars[i] = chars[i-1]
                chars[i-1] = tmp
                n2 = i
            }
        }
        n = n2
        if n == 0 {
            break
        }
    }
    s = string(chars)
    if trim {
        s = strings.TrimLeft(s, " \t\r\n")
    }
    return s
}

func main() {
    ss := []string{
        "forever go programming language",
        "Now is the time for all good men to come to the aid of their country.",
    }
    trims := []bool{true, false}
    for i, s := range ss {
        res := bubbleSort(s, trims[i])
        fmt.Printf("Unsorted->%s\n", s)
        fmt.Printf("Sorted  ->%s\n\n", res)
    }
}




Python: 

from functools import reduce



def qSort(xs):
    
    if xs:
        h = xs[0]
        below, above = partition(
            lambda v: v <= h
        )(xs[1:])

        return qSort(below) + [h] + qSort(above)
    else:
        return []



def main():
    
    print(quoted('"')(
        ''.join(qSort(list(
            "Is this misspelling of alphabetical as alphabitical a joke ?"
        )))
    ))





def partition(p):
    
    def go(a, x):
        ts, fs = a
        return (ts + [x], fs) if p(x) else (ts, fs + [x])
    return lambda xs: reduce(go, xs, ([], []))



def quoted(c):
    
    return lambda s: c + s + c



if __name__ == '__main__':
    main()
Task: Sort the letters of string in alphabetical order




Go: package main

import (
    "fmt"
    "strings"
)

func bubbleSort(s string, trim bool) string { 
    chars := []rune(s)
    n := len(chars)
    for {
        n2 := 0
        for i := 1; i < n; i++ {
            if chars[i-1] > chars[i] {
                tmp := chars[i]
                chars[i] = chars[i-1]
                chars[i-1] = tmp
                n2 = i
            }
        }
        n = n2
        if n == 0 {
            break
        }
    }
    s = string(chars)
    if trim {
        s = strings.TrimLeft(s, " \t\r\n")
    }
    return s
}

func main() {
    ss := []string{
        "forever go programming language",
        "Now is the time for all good men to come to the aid of their country.",
    }
    trims := []bool{true, false}
    for i, s := range ss {
        res := bubbleSort(s, trims[i])
        fmt.Printf("Unsorted->%s\n", s)
        fmt.Printf("Sorted  ->%s\n\n", res)
    }
}





VB: sub bubble(arr)
  n = UBound(arr)
  Do
    nn = -1
    For j = 0 to n - 1
        If arr(j) > arr(j + 1) Then
            temp= arr(j):arr(j)=arr(j+1):arr(j+1)=temp
           nn = j
        End If
    Next
    n = nn
  Loop Until nn = -1
end sub


s="The quick brown fox jumps over the lazy dog, apparently"
redim a(len(s)-1)
for i=1 to len(s)
   a(i-1)=mid(s,i,1)
next
bubble a
s1=join(a,"")
wscript.echo s1
Task: Sort the letters of string in alphabetical order







Python: 

from functools import reduce



def qSort(xs):
    
    if xs:
        h = xs[0]
        below, above = partition(
            lambda v: v <= h
        )(xs[1:])

        return qSort(below) + [h] + qSort(above)
    else:
        return []



def main():
    
    print(quoted('"')(
        ''.join(qSort(list(
            "Is this misspelling of alphabetical as alphabitical a joke ?"
        )))
    ))





def partition(p):
    
    def go(a, x):
        ts, fs = a
        return (ts + [x], fs) if p(x) else (ts, fs + [x])
    return lambda xs: reduce(go, xs, ([], []))



def quoted(c):
    
    return lambda s: c + s + c



if __name__ == '__main__':
    main()


VB: sub bubble(arr)
  n = UBound(arr)
  Do
    nn = -1
    For j = 0 to n - 1
        If arr(j) > arr(j + 1) Then
            temp= arr(j):arr(j)=arr(j+1):arr(j+1)=temp
           nn = j
        End If
    Next
    n = nn
  Loop Until nn = -1
end sub


s="The quick brown fox jumps over the lazy dog, apparently"
redim a(len(s)-1)
for i=1 to len(s)
   a(i-1)=mid(s,i,1)
next
bubble a
s1=join(a,"")
wscript.echo s1