kazuyamaa/multi-language-messages-01 huggingface dataset:
Task: Reverse words in a string
C: #include <stdio.h>
#include <ctype.h>

void rev_print(char *s, int n)
{
        for (; *s && isspace(*s); s++);
        if (*s) {
                char *e;
                for (e = s; *e && !isspace(*e); e++);
                rev_print(e, 0);
                printf("%.*s%s", (int)(e - s), s, " " + n);
        }
        if (n) putchar('\n');
}

int main(void)
{
        char *s[] = {
                "---------- Ice and Fire ------------",
                "                                    ",
                "fire, in end will world the say Some",
                "ice. in say Some                    ",
                "desire of tasted I've what From     ",
                "fire. favor who those with hold I   ",
                "                                    ",
                "... elided paragraph last ...       ",
                "                                    ",
                "Frost Robert -----------------------",
                0
        };
        int i;
        for (i = 0; s[i]; i++) rev_print(s[i], 1);

        return 0;
}

VB: Option Explicit

Sub Main()
Dim Lines(9) As String, i&
    
    Lines(0) = "------------- Ice And Fire -------------"
    Lines(1) = ""
    Lines(2) = "fire, in end will world the say Some"
    Lines(3) = "ice. in say Some"
    Lines(4) = "desire of tasted I
    Lines(5) = "fire. favor who those with hold I"
    Lines(6) = ""
    Lines(7) = "... elided paragraph last ..."
    Lines(8) = ""
    Lines(9) = "Frost Robert -----------------------"
    
    For i = 0 To 9
        Debug.Print ReverseLine(Lines(i), " ")
    Next
End Sub

Private Function ReverseLine(Line As String, Optional Separat As String) As String
Dim T, R, i&, j&, deb&, fin&
    If Len(Line) = 0 Then
        ReverseLine = vbNullString
    Else
        If Separat = "" Then Separat = " "
        T = Split(Line, Separat)
        ReDim R(UBound(T)): j = LBound(T)
        deb = UBound(T): fin = deb / 2
        For i = deb To fin Step -1
            R(j) = T(i)
            R(i) = T(j)
            j = j + 1
        Next i
        ReverseLine = Join(R, Separat)
    End If
End Function
Task: Reverse words in a string
C#: using System;

public class ReverseWordsInString
{
    public static void Main(string[] args)
    {
        string text = @"
            ---------- Ice and Fire ------------

            fire, in end will world the say Some
            ice. in say Some
            desire of tasted I've what From
            fire. favor who those with hold I

            ... elided paragraph last ...

            Frost Robert -----------------------
            ";

        foreach (string line in text.Split(Environment.NewLine)) {
            
            string[] words = line.Split(default(char[]), StringSplitOptions.RemoveEmptyEntries);
            Array.Reverse(words);
            WriteLine(string.Join(" ", words));
        }
    }
}

Go: package main

import (
    "fmt"
    "strings"
)


var n = []string{
    "---------- Ice and Fire ------------",
    "                                    ",
    "fire, in end will world the say Some",
    "ice. in say Some                    ",
    "desire of tasted I've what From     ",
    "fire. favor who those with hold I   ",
    "                                    ",
    "... elided paragraph last ...       ",
    "                                    ",
    "Frost Robert -----------------------",
}

func main() {
    for i, s := range n {
        t := strings.Fields(s) 
        
        last := len(t) - 1
        for j, k := range t[:len(t)/2] {
            t[j], t[last-j] = t[last-j], k
        }
        n[i] = strings.Join(t, " ")
    }
    
    for _, t := range n {
        fmt.Println(t)
    }
}
Task: Reverse words in a string
C#: using System;

public class ReverseWordsInString
{
    public static void Main(string[] args)
    {
        string text = @"
            ---------- Ice and Fire ------------

            fire, in end will world the say Some
            ice. in say Some
            desire of tasted I've what From
            fire. favor who those with hold I

            ... elided paragraph last ...

            Frost Robert -----------------------
            ";

        foreach (string line in text.Split(Environment.NewLine)) {
            
            string[] words = line.Split(default(char[]), StringSplitOptions.RemoveEmptyEntries);
            Array.Reverse(words);
            WriteLine(string.Join(" ", words));
        }
    }
}

Python:  text = 

for line in text.split('\n'): print(' '.join(line.split()[::-1]))
Task: Reverse words in a string
C#: using System;

public class ReverseWordsInString
{
    public static void Main(string[] args)
    {
        string text = @"
            ---------- Ice and Fire ------------

            fire, in end will world the say Some
            ice. in say Some
            desire of tasted I've what From
            fire. favor who those with hold I

            ... elided paragraph last ...

            Frost Robert -----------------------
            ";

        foreach (string line in text.Split(Environment.NewLine)) {
            
            string[] words = line.Split(default(char[]), StringSplitOptions.RemoveEmptyEntries);
            Array.Reverse(words);
            WriteLine(string.Join(" ", words));
        }
    }
}

VB: Option Explicit

Sub Main()
Dim Lines(9) As String, i&
    
    Lines(0) = "------------- Ice And Fire -------------"
    Lines(1) = ""
    Lines(2) = "fire, in end will world the say Some"
    Lines(3) = "ice. in say Some"
    Lines(4) = "desire of tasted I
    Lines(5) = "fire. favor who those with hold I"
    Lines(6) = ""
    Lines(7) = "... elided paragraph last ..."
    Lines(8) = ""
    Lines(9) = "Frost Robert -----------------------"
    
    For i = 0 To 9
        Debug.Print ReverseLine(Lines(i), " ")
    Next
End Sub

Private Function ReverseLine(Line As String, Optional Separat As String) As String
Dim T, R, i&, j&, deb&, fin&
    If Len(Line) = 0 Then
        ReverseLine = vbNullString
    Else
        If Separat = "" Then Separat = " "
        T = Split(Line, Separat)
        ReDim R(UBound(T)): j = LBound(T)
        deb = UBound(T): fin = deb / 2
        For i = deb To fin Step -1
            R(j) = T(i)
            R(i) = T(j)
            j = j + 1
        Next i
        ReverseLine = Join(R, Separat)
    End If
End Function
Task: Reverse words in a string
Go: package main

import (
    "fmt"
    "strings"
)


var n = []string{
    "---------- Ice and Fire ------------",
    "                                    ",
    "fire, in end will world the say Some",
    "ice. in say Some                    ",
    "desire of tasted I've what From     ",
    "fire. favor who those with hold I   ",
    "                                    ",
    "... elided paragraph last ...       ",
    "                                    ",
    "Frost Robert -----------------------",
}

func main() {
    for i, s := range n {
        t := strings.Fields(s) 
        
        last := len(t) - 1
        for j, k := range t[:len(t)/2] {
            t[j], t[last-j] = t[last-j], k
        }
        n[i] = strings.Join(t, " ")
    }
    
    for _, t := range n {
        fmt.Println(t)
    }
}

Java: public class ReverseWords {

    static final String[] lines = {
        " ----------- Ice and Fire ----------- ",
        "                                      ",
        " fire, in end will world the say Some ",
        " ice. in say Some                     ",
        " desire of tasted I've what From      ",
        " fire. favor who those with hold I    ",
        "                                      ",
        " ... elided paragraph last ...        ",
        " Frost Robert ----------------------- "};

    public static void main(String[] args) {
        for (String line : lines) {
            String[] words = line.split("\\s");
            for (int i = words.length - 1; i >= 0; i--)
                System.out.printf("%s ", words[i]);
            System.out.println();
        }
    }
}
Task: Reverse words in a string
Java: public class ReverseWords {

    static final String[] lines = {
        " ----------- Ice and Fire ----------- ",
        "                                      ",
        " fire, in end will world the say Some ",
        " ice. in say Some                     ",
        " desire of tasted I've what From      ",
        " fire. favor who those with hold I    ",
        "                                      ",
        " ... elided paragraph last ...        ",
        " Frost Robert ----------------------- "};

    public static void main(String[] args) {
        for (String line : lines) {
            String[] words = line.split("\\s");
            for (int i = words.length - 1; i >= 0; i--)
                System.out.printf("%s ", words[i]);
            System.out.println();
        }
    }
}

Python:  text = 

for line in text.split('\n'): print(' '.join(line.split()[::-1]))
Task: Reverse words in a string
Java: public class ReverseWords {

    static final String[] lines = {
        " ----------- Ice and Fire ----------- ",
        "                                      ",
        " fire, in end will world the say Some ",
        " ice. in say Some                     ",
        " desire of tasted I've what From      ",
        " fire. favor who those with hold I    ",
        "                                      ",
        " ... elided paragraph last ...        ",
        " Frost Robert ----------------------- "};

    public static void main(String[] args) {
        for (String line : lines) {
            String[] words = line.split("\\s");
            for (int i = words.length - 1; i >= 0; i--)
                System.out.printf("%s ", words[i]);
            System.out.println();
        }
    }
}

VB: Option Explicit

Sub Main()
Dim Lines(9) As String, i&
    
    Lines(0) = "------------- Ice And Fire -------------"
    Lines(1) = ""
    Lines(2) = "fire, in end will world the say Some"
    Lines(3) = "ice. in say Some"
    Lines(4) = "desire of tasted I
    Lines(5) = "fire. favor who those with hold I"
    Lines(6) = ""
    Lines(7) = "... elided paragraph last ..."
    Lines(8) = ""
    Lines(9) = "Frost Robert -----------------------"
    
    For i = 0 To 9
        Debug.Print ReverseLine(Lines(i), " ")
    Next
End Sub

Private Function ReverseLine(Line As String, Optional Separat As String) As String
Dim T, R, i&, j&, deb&, fin&
    If Len(Line) = 0 Then
        ReverseLine = vbNullString
    Else
        If Separat = "" Then Separat = " "
        T = Split(Line, Separat)
        ReDim R(UBound(T)): j = LBound(T)
        deb = UBound(T): fin = deb / 2
        For i = deb To fin Step -1
            R(j) = T(i)
            R(i) = T(j)
            j = j + 1
        Next i
        ReverseLine = Join(R, Separat)
    End If
End Function
Task: Reverse words in a string
Go: package main

import (
    "fmt"
    "strings"
)


var n = []string{
    "---------- Ice and Fire ------------",
    "                                    ",
    "fire, in end will world the say Some",
    "ice. in say Some                    ",
    "desire of tasted I've what From     ",
    "fire. favor who those with hold I   ",
    "                                    ",
    "... elided paragraph last ...       ",
    "                                    ",
    "Frost Robert -----------------------",
}

func main() {
    for i, s := range n {
        t := strings.Fields(s) 
        
        last := len(t) - 1
        for j, k := range t[:len(t)/2] {
            t[j], t[last-j] = t[last-j], k
        }
        n[i] = strings.Join(t, " ")
    }
    
    for _, t := range n {
        fmt.Println(t)
    }
}

Python:  text = 

for line in text.split('\n'): print(' '.join(line.split()[::-1]))
Task: Reverse words in a string
Go: package main

import (
    "fmt"
    "strings"
)


var n = []string{
    "---------- Ice and Fire ------------",
    "                                    ",
    "fire, in end will world the say Some",
    "ice. in say Some                    ",
    "desire of tasted I've what From     ",
    "fire. favor who those with hold I   ",
    "                                    ",
    "... elided paragraph last ...       ",
    "                                    ",
    "Frost Robert -----------------------",
}

func main() {
    for i, s := range n {
        t := strings.Fields(s) 
        
        last := len(t) - 1
        for j, k := range t[:len(t)/2] {
            t[j], t[last-j] = t[last-j], k
        }
        n[i] = strings.Join(t, " ")
    }
    
    for _, t := range n {
        fmt.Println(t)
    }
}

VB: Option Explicit

Sub Main()
Dim Lines(9) As String, i&
    
    Lines(0) = "------------- Ice And Fire -------------"
    Lines(1) = ""
    Lines(2) = "fire, in end will world the say Some"
    Lines(3) = "ice. in say Some"
    Lines(4) = "desire of tasted I
    Lines(5) = "fire. favor who those with hold I"
    Lines(6) = ""
    Lines(7) = "... elided paragraph last ..."
    Lines(8) = ""
    Lines(9) = "Frost Robert -----------------------"
    
    For i = 0 To 9
        Debug.Print ReverseLine(Lines(i), " ")
    Next
End Sub

Private Function ReverseLine(Line As String, Optional Separat As String) As String
Dim T, R, i&, j&, deb&, fin&
    If Len(Line) = 0 Then
        ReverseLine = vbNullString
    Else
        If Separat = "" Then Separat = " "
        T = Split(Line, Separat)
        ReDim R(UBound(T)): j = LBound(T)
        deb = UBound(T): fin = deb / 2
        For i = deb To fin Step -1
            R(j) = T(i)
            R(i) = T(j)
            j = j + 1
        Next i
        ReverseLine = Join(R, Separat)
    End If
End Function
Task: Reverse words in a string
Python:  text = 

for line in text.split('\n'): print(' '.join(line.split()[::-1]))

VB: Option Explicit

Sub Main()
Dim Lines(9) As String, i&
    
    Lines(0) = "------------- Ice And Fire -------------"
    Lines(1) = ""
    Lines(2) = "fire, in end will world the say Some"
    Lines(3) = "ice. in say Some"
    Lines(4) = "desire of tasted I
    Lines(5) = "fire. favor who those with hold I"
    Lines(6) = ""
    Lines(7) = "... elided paragraph last ..."
    Lines(8) = ""
    Lines(9) = "Frost Robert -----------------------"
    
    For i = 0 To 9
        Debug.Print ReverseLine(Lines(i), " ")
    Next
End Sub

Private Function ReverseLine(Line As String, Optional Separat As String) As String
Dim T, R, i&, j&, deb&, fin&
    If Len(Line) = 0 Then
        ReverseLine = vbNullString
    Else
        If Separat = "" Then Separat = " "
        T = Split(Line, Separat)
        ReDim R(UBound(T)): j = LBound(T)
        deb = UBound(T): fin = deb / 2
        For i = deb To fin Step -1
            R(j) = T(i)
            R(i) = T(j)
            j = j + 1
        Next i
        ReverseLine = Join(R, Separat)
    End If
End Function
Task: Reverse words in a string
C#: using System;

public class ReverseWordsInString
{
    public static void Main(string[] args)
    {
        string text = @"
            ---------- Ice and Fire ------------

            fire, in end will world the say Some
            ice. in say Some
            desire of tasted I've what From
            fire. favor who those with hold I

            ... elided paragraph last ...

            Frost Robert -----------------------
            ";

        foreach (string line in text.Split(Environment.NewLine)) {
            
            string[] words = line.Split(default(char[]), StringSplitOptions.RemoveEmptyEntries);
            Array.Reverse(words);
            WriteLine(string.Join(" ", words));
        }
    }
}

Java: public class ReverseWords {

    static final String[] lines = {
        " ----------- Ice and Fire ----------- ",
        "                                      ",
        " fire, in end will world the say Some ",
        " ice. in say Some                     ",
        " desire of tasted I've what From      ",
        " fire. favor who those with hold I    ",
        "                                      ",
        " ... elided paragraph last ...        ",
        " Frost Robert ----------------------- "};

    public static void main(String[] args) {
        for (String line : lines) {
            String[] words = line.split("\\s");
            for (int i = words.length - 1; i >= 0; i--)
                System.out.printf("%s ", words[i]);
            System.out.println();
        }
    }
}
Task: Feigenbaum constant calculation
C++: #include <iostream>

int main() {
    const int max_it = 13;
    const int max_it_j = 10;
    double a1 = 1.0, a2 = 0.0, d1 = 3.2;

    std::cout << " i       d\n";
    for (int i = 2; i <= max_it; ++i) {
        double a = a1 + (a1 - a2) / d1;
        for (int j = 1; j <= max_it_j; ++j) {
            double x = 0.0;
            double y = 0.0;
            for (int k = 1; k <= 1 << i; ++k) {
                y = 1.0 - 2.0*y*x;
                x = a - x * x;
            }
            a -= x / y;
        }
        double d = (a1 - a2) / (a - a1);
        printf("%2d    %.8f\n", i, d);
        d1 = d;
        a2 = a1;
        a1 = a;
    }

    return 0;
}

Go: package main

import "fmt"

func feigenbaum() {
    maxIt, maxItJ := 13, 10
    a1, a2, d1 := 1.0, 0.0, 3.2
    fmt.Println(" i       d")
    for i := 2; i <= maxIt; i++ {
        a := a1 + (a1-a2)/d1
        for j := 1; j <= maxItJ; j++ {
            x, y := 0.0, 0.0
            for k := 1; k <= 1<<uint(i); k++ {
                y = 1.0 - 2.0*y*x
                x = a - x*x
            }
            a -= x / y
        }
        d := (a1 - a2) / (a - a1)
        fmt.Printf("%2d    %.8f\n", i, d)
        d1, a2, a1 = d, a1, a
    }
}

func main() {
    feigenbaum()
}
Task: Feigenbaum constant calculation
C++: #include <iostream>

int main() {
    const int max_it = 13;
    const int max_it_j = 10;
    double a1 = 1.0, a2 = 0.0, d1 = 3.2;

    std::cout << " i       d\n";
    for (int i = 2; i <= max_it; ++i) {
        double a = a1 + (a1 - a2) / d1;
        for (int j = 1; j <= max_it_j; ++j) {
            double x = 0.0;
            double y = 0.0;
            for (int k = 1; k <= 1 << i; ++k) {
                y = 1.0 - 2.0*y*x;
                x = a - x * x;
            }
            a -= x / y;
        }
        double d = (a1 - a2) / (a - a1);
        printf("%2d    %.8f\n", i, d);
        d1 = d;
        a2 = a1;
        a1 = a;
    }

    return 0;
}

Java: public class Feigenbaum {
    public static void main(String[] args) {
        int max_it = 13;
        int max_it_j = 10;
        double a1 = 1.0;
        double a2 = 0.0;
        double d1 = 3.2;
        double a;

        System.out.println(" i       d");
        for (int i = 2; i <= max_it; i++) {
            a = a1 + (a1 - a2) / d1;
            for (int j = 0; j < max_it_j; j++) {
                double x = 0.0;
                double y = 0.0;
                for (int k = 0; k < 1 << i; k++) {
                    y = 1.0 - 2.0 * y * x;
                    x = a - x * x;
                }
                a -= x / y;
            }
            double d = (a1 - a2) / (a - a1);
            System.out.printf("%2d    %.8f\n", i, d);
            d1 = d;
            a2 = a1;
            a1 = a;
        }
    }
}
Task: Feigenbaum constant calculation
C++: #include <iostream>

int main() {
    const int max_it = 13;
    const int max_it_j = 10;
    double a1 = 1.0, a2 = 0.0, d1 = 3.2;

    std::cout << " i       d\n";
    for (int i = 2; i <= max_it; ++i) {
        double a = a1 + (a1 - a2) / d1;
        for (int j = 1; j <= max_it_j; ++j) {
            double x = 0.0;
            double y = 0.0;
            for (int k = 1; k <= 1 << i; ++k) {
                y = 1.0 - 2.0*y*x;
                x = a - x * x;
            }
            a -= x / y;
        }
        double d = (a1 - a2) / (a - a1);
        printf("%2d    %.8f\n", i, d);
        d1 = d;
        a2 = a1;
        a1 = a;
    }

    return 0;
}

Python: max_it = 13
max_it_j = 10
a1 = 1.0
a2 = 0.0
d1 = 3.2
a = 0.0

print " i       d"
for i in range(2, max_it + 1):
    a = a1 + (a1 - a2) / d1
    for j in range(1, max_it_j + 1):
        x = 0.0
        y = 0.0
        for k in range(1, (1 << i) + 1):
            y = 1.0 - 2.0 * y * x
            x = a - x * x
        a = a - x / y
    d = (a1 - a2) / (a - a1)
    print("{0:2d}    {1:.8f}".format(i, d))
    d1 = d
    a2 = a1
    a1 = a
Task: Feigenbaum constant calculation
Go: package main

import "fmt"

func feigenbaum() {
    maxIt, maxItJ := 13, 10
    a1, a2, d1 := 1.0, 0.0, 3.2
    fmt.Println(" i       d")
    for i := 2; i <= maxIt; i++ {
        a := a1 + (a1-a2)/d1
        for j := 1; j <= maxItJ; j++ {
            x, y := 0.0, 0.0
            for k := 1; k <= 1<<uint(i); k++ {
                y = 1.0 - 2.0*y*x
                x = a - x*x
            }
            a -= x / y
        }
        d := (a1 - a2) / (a - a1)
        fmt.Printf("%2d    %.8f\n", i, d)
        d1, a2, a1 = d, a1, a
    }
}

func main() {
    feigenbaum()
}

Java: public class Feigenbaum {
    public static void main(String[] args) {
        int max_it = 13;
        int max_it_j = 10;
        double a1 = 1.0;
        double a2 = 0.0;
        double d1 = 3.2;
        double a;

        System.out.println(" i       d");
        for (int i = 2; i <= max_it; i++) {
            a = a1 + (a1 - a2) / d1;
            for (int j = 0; j < max_it_j; j++) {
                double x = 0.0;
                double y = 0.0;
                for (int k = 0; k < 1 << i; k++) {
                    y = 1.0 - 2.0 * y * x;
                    x = a - x * x;
                }
                a -= x / y;
            }
            double d = (a1 - a2) / (a - a1);
            System.out.printf("%2d    %.8f\n", i, d);
            d1 = d;
            a2 = a1;
            a1 = a;
        }
    }
}
Task: Feigenbaum constant calculation
Java: public class Feigenbaum {
    public static void main(String[] args) {
        int max_it = 13;
        int max_it_j = 10;
        double a1 = 1.0;
        double a2 = 0.0;
        double d1 = 3.2;
        double a;

        System.out.println(" i       d");
        for (int i = 2; i <= max_it; i++) {
            a = a1 + (a1 - a2) / d1;
            for (int j = 0; j < max_it_j; j++) {
                double x = 0.0;
                double y = 0.0;
                for (int k = 0; k < 1 << i; k++) {
                    y = 1.0 - 2.0 * y * x;
                    x = a - x * x;
                }
                a -= x / y;
            }
            double d = (a1 - a2) / (a - a1);
            System.out.printf("%2d    %.8f\n", i, d);
            d1 = d;
            a2 = a1;
            a1 = a;
        }
    }
}

Python: max_it = 13
max_it_j = 10
a1 = 1.0
a2 = 0.0
d1 = 3.2
a = 0.0

print " i       d"
for i in range(2, max_it + 1):
    a = a1 + (a1 - a2) / d1
    for j in range(1, max_it_j + 1):
        x = 0.0
        y = 0.0
        for k in range(1, (1 << i) + 1):
            y = 1.0 - 2.0 * y * x
            x = a - x * x
        a = a - x / y
    d = (a1 - a2) / (a - a1)
    print("{0:2d}    {1:.8f}".format(i, d))
    d1 = d
    a2 = a1
    a1 = a
Task: Feigenbaum constant calculation
Go: package main

import "fmt"

func feigenbaum() {
    maxIt, maxItJ := 13, 10
    a1, a2, d1 := 1.0, 0.0, 3.2
    fmt.Println(" i       d")
    for i := 2; i <= maxIt; i++ {
        a := a1 + (a1-a2)/d1
        for j := 1; j <= maxItJ; j++ {
            x, y := 0.0, 0.0
            for k := 1; k <= 1<<uint(i); k++ {
                y = 1.0 - 2.0*y*x
                x = a - x*x
            }
            a -= x / y
        }
        d := (a1 - a2) / (a - a1)
        fmt.Printf("%2d    %.8f\n", i, d)
        d1, a2, a1 = d, a1, a
    }
}

func main() {
    feigenbaum()
}

Python: max_it = 13
max_it_j = 10
a1 = 1.0
a2 = 0.0
d1 = 3.2
a = 0.0

print " i       d"
for i in range(2, max_it + 1):
    a = a1 + (a1 - a2) / d1
    for j in range(1, max_it_j + 1):
        x = 0.0
        y = 0.0
        for k in range(1, (1 << i) + 1):
            y = 1.0 - 2.0 * y * x
            x = a - x * x
        a = a - x / y
    d = (a1 - a2) / (a - a1)
    print("{0:2d}    {1:.8f}".format(i, d))
    d1 = d
    a2 = a1
    a1 = a