CODING CHALLENGE.

Status
This thread has been locked.

Sonnet

History
Banned
Feedback score
0
Posts
106
Reactions
69
Resources
0
Whatever language you want to write this in, do it:

You have these three strings:

"23mn-232,d39ek0.23"
"234.23jkdsj3/3kdsaa03'd"
"dnsao39duj3//.d.e;p3"

Your objective:

capture all the digits in the first string
all the letters in the second string
and all the non character words in the third string

Combine string one with string two, then combine string three into the middle of the new string.
 
Banned forever. Reason: Scamming (https://builtbybit.com/threads/sonnet-scam-report.106789/)
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

Chearful

thomas.gg
Supreme
Feedback score
115
Posts
1,398
Reactions
2,236
Resources
0
By 'non character words' do you mean letters + numbers?
 

Nagi

PM Only - No Skype
Supreme
Feedback score
12
Posts
535
Reactions
679
Resources
0
I don't even understand the question that well but I did what I understood.

Code:
Code:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Challenge {

    public static void main(String[] args) throws IOException {

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        String stringA = reader.readLine().replaceAll("[^0-9]", "");
        String stringB = reader.readLine().replaceAll("[^a-zA-Z]", "");
        String stringC = reader.readLine().replaceAll("[0-9a-zA-Z]", "");

        reader.close();
       
        String comboA = stringA + stringB;
        int middleIndex = comboA.length() / 2;
        System.out.println(comboA.substring(0, middleIndex) + stringC + comboA.substring(middleIndex));

    }
}

Input:
Code:
23mn-232,d39ek0.23
234.23jkdsj3/3kdsaa03'd
dnsao39duj3//.d.e;p3

Output:
Code:
2323239023//..;jkdsjkdsaad
 

Sonnet

History
Banned
Feedback score
0
Posts
106
Reactions
69
Resources
0
Good job Nagi

Here is my solution in Ruby:

Code:
string_1 = "23mn-232,d39ek0.23"
string_2 = "234.23jkdsj3/3kdsaa03'd"
string_3 = "dnsao39duj3//.d.e;p3"

conv_string1 = string_1[/\d/]
conv_string2 = string_2[/[a-z]/]
conv_string3 = string_3[/\W/]

new_string = conv_string1 + conv_string3 + conv_string2
 
Banned forever. Reason: Scamming (https://builtbybit.com/threads/sonnet-scam-report.106789/)

Chearful

thomas.gg
Supreme
Feedback score
115
Posts
1,398
Reactions
2,236
Resources
0
Mine in Skript:
Code:
Command /chearfulforpresident:
    trigger:
        set {_string1} to "23mn-232,d39ek0.23"
        remove all "m" from {_string1}
        remove all "n" from {_string1}
        remove all "-" from {_string1}
        remove all "," from {_string1}
        remove all "." from {_string1}
        remove all "d" from {_string1}
        remove all "e" from {_string1}
        remove all "k" from {_string1}
        message "&3[&aResult&3]&d Digits from string1: %{_string1}%"
        set {_string2} to "234.23jkdsj3/3kdsaa03'd"
        set {_string2.loopct} to 0
        loop 10 times:
            remove {_string2.loopct} from {_string2}
            add 1 to {_string2.loopct}
        remove all "." from {_string2}
        remove all "/" from {_string2}
        remove all "'" from {_string2}
        message "&3[&aResult&3]&d Letters from string2: %{_string2}%"
        set {_string3} to "dnsao39duj3//.d.e;p3"
        loop 10 times:
            remove {_string3.loopct} from {_string3}
            add 1 to {_string3.loopct}
        remove all "d" from {_string3}
        remove all "n" from {_string3}
        remove all "s" from {_string3}
        remove all "a" from {_string3}
        remove all "o" from {_string3}
        remove all "e" from {_string3}
        remove all "j" from {_string3}
        remove all "p" from {_string3}
        message "&3[&aResult&3]&d Non chars from string3: %{_string3}%"
        set {_output} to "%{_string1}%%{_string3}%%{_string2}%"
        message "&3[&aResult&3]&d Final output: %{_output}%"
 

Kuh

Feedback score
0
Posts
19
Reactions
11
Resources
0
Javascript:
Code:
var string1 =      "23mn-232,d39ek0.23".replace(/[^0-9]/g, '');
var string2 = "234.23jkdsj3/3kdsaa03'd".replace(/[^a-z]/gi, '');
var string3 =    "dnsao39duj3//.d.e;p3".replace(/[a-z0-9]/g, '');

var tmp = string1 + string2;
var result = [tmp.slice(0, tmp.length/2), string3, tmp.slice(tmp.length/2)].join('');
console.log(result);
 
Status
This thread has been locked.
Top