Split it. But not all!
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
Inspired by this StackOverflow question.
Input:
We'll take three inputs:
- A delimiter-character
D
to split on - A character
I
within we ignore the character to split on (I know, that sounds vague, but I'll explain it below) - A string
S
Output:
A list/array containing the substrings after the split.
Example:
Input:
D = ','
I = '"'
S = '11020199,"Abc ",aduz,,444,bieb,dc,2 ,2222.00,whatever 5dc,222.22,22.00,"98,00","12,000,000",21-09-2018, 06:00,",-,"'
Output:
['11020199', 'Abc ', 'aduz', '', '444', 'bieb', 'dc', '2 ', '2222.00', 'whatever 5dc', '222.22', '22.00', '98,00', '12,000,000', '21-09-2018', ' 06:00', ',-,']
Why? Splitting on comma would normally also split 98,00
, 12,000,000
and ,-,
in two/three pieces. But because they are within the I
input character, we ignore ignore the split here.
Challenge rules:
- You can assume there will always be an even amount of
I
characters in the input-string. - You can assume the character
I
will always have aD
next to it (except when it's the first or last character of the input). So you won't have something likeD = ','; I = '"'; S = 'a,b"c,d"e,f'
. - The input-string
S
could contain none of eitherD
orI
. If it contains noD
, we output a list with the entire input-string as only item. - The output list won't contain the character
I
anymore, even when it contained noD
(as you can see at the"Abc "
becoming'Abc '
in the example above). - It is possible that the substring within
I
contains onlyD
. For example:D = ','; I = '"'; S = 'a,",",b,"c","d,e,,",f'
would result in['a', ',', 'b', 'c', 'd,e,,', 'f']
. - When an input has a leading or trailing
D
, or two adjacentD
, we'll have an empty item. I.e.D = ','; I = '"'; S = ',"a,b",c,,d,""'
would result in['', 'a,b', 'c', '', 'd', '']
. - You can assume the inputs and outputs will only contain printable ASCII in the range
[32, 126]
(so excluding tabs and newlines). - You are also allowed to output all items new-line delimited instead of returning/outputting a list/array (especially for those languages that don't have lists/arrays; i.e. Retina).
General rules:
- This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
Default Loopholes are forbidden.- If possible, please add a link with a test for your code (i.e. TIO).
- Also, adding an explanation for your answer is highly recommended.
Test cases:
Input:
D = ','; I = '"'; S = '11020199,"Abc ",aduz,,444,bieb,dc,2 ,2222.00,whatever 5dc,222.22,22.00,"98,00","12,000,000",21-09-2018, 06:00,",-,"'
Output:
['11020199', 'Abc ', 'aduz', '', '444', 'bieb', 'dc', '2 ', '2222.00', 'whatever 5dc', '222.22', '22.00', '98,00', '12,000,000', '21-09-2018', ' 06:00', ',-,']
Input:
D = ' '; I = ','; S = 'this is a test , to see if you understand it, or not , hmmm, I think I have too many commas , or not , perhaps..'
Output:
['this', 'is', 'a', 'test', ' to see if you understand it', 'or', 'not', ' hmmm', 'I', 'think', 'I', 'have', 'too', 'many', 'commas', ' or not ', 'perhaps..']
Input:
D = ','; I = '"'; S = 'a,",",b,"c","d,e,,",f'
Output:
['a', ',', 'b', 'c', 'd,e,,', 'f']
Input:
D = ','; I = '"'; S = ',"a,b",c,,d,""'
Output:
['', 'a,b', 'c', '', 'd', '']
Input:
D = 'x'; I = 'y'; S = 'contains no lowercase X nor Y'
Output:
['contains no lowercase X nor Y']
Input:
D = ' '; I = 'I'; S = "I'll remove all I"
Output:
["", "'ll remove all ", ""]
Input:
D = '1'; I = '3'; S = '1358984197316913997510582097494459207831640628620894825421137067931'
Output: ['', '58984197', '69', '9975105820974944592078', '64062862089482542', '', '70679', '']
Input:
D = ' '; I = 'S'; S = 'regular split on spaces'
Output:
['regular', 'split', 'on', 'spaces']
code-golf string
add a comment |Â
up vote
1
down vote
favorite
Inspired by this StackOverflow question.
Input:
We'll take three inputs:
- A delimiter-character
D
to split on - A character
I
within we ignore the character to split on (I know, that sounds vague, but I'll explain it below) - A string
S
Output:
A list/array containing the substrings after the split.
Example:
Input:
D = ','
I = '"'
S = '11020199,"Abc ",aduz,,444,bieb,dc,2 ,2222.00,whatever 5dc,222.22,22.00,"98,00","12,000,000",21-09-2018, 06:00,",-,"'
Output:
['11020199', 'Abc ', 'aduz', '', '444', 'bieb', 'dc', '2 ', '2222.00', 'whatever 5dc', '222.22', '22.00', '98,00', '12,000,000', '21-09-2018', ' 06:00', ',-,']
Why? Splitting on comma would normally also split 98,00
, 12,000,000
and ,-,
in two/three pieces. But because they are within the I
input character, we ignore ignore the split here.
Challenge rules:
- You can assume there will always be an even amount of
I
characters in the input-string. - You can assume the character
I
will always have aD
next to it (except when it's the first or last character of the input). So you won't have something likeD = ','; I = '"'; S = 'a,b"c,d"e,f'
. - The input-string
S
could contain none of eitherD
orI
. If it contains noD
, we output a list with the entire input-string as only item. - The output list won't contain the character
I
anymore, even when it contained noD
(as you can see at the"Abc "
becoming'Abc '
in the example above). - It is possible that the substring within
I
contains onlyD
. For example:D = ','; I = '"'; S = 'a,",",b,"c","d,e,,",f'
would result in['a', ',', 'b', 'c', 'd,e,,', 'f']
. - When an input has a leading or trailing
D
, or two adjacentD
, we'll have an empty item. I.e.D = ','; I = '"'; S = ',"a,b",c,,d,""'
would result in['', 'a,b', 'c', '', 'd', '']
. - You can assume the inputs and outputs will only contain printable ASCII in the range
[32, 126]
(so excluding tabs and newlines). - You are also allowed to output all items new-line delimited instead of returning/outputting a list/array (especially for those languages that don't have lists/arrays; i.e. Retina).
General rules:
- This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
Default Loopholes are forbidden.- If possible, please add a link with a test for your code (i.e. TIO).
- Also, adding an explanation for your answer is highly recommended.
Test cases:
Input:
D = ','; I = '"'; S = '11020199,"Abc ",aduz,,444,bieb,dc,2 ,2222.00,whatever 5dc,222.22,22.00,"98,00","12,000,000",21-09-2018, 06:00,",-,"'
Output:
['11020199', 'Abc ', 'aduz', '', '444', 'bieb', 'dc', '2 ', '2222.00', 'whatever 5dc', '222.22', '22.00', '98,00', '12,000,000', '21-09-2018', ' 06:00', ',-,']
Input:
D = ' '; I = ','; S = 'this is a test , to see if you understand it, or not , hmmm, I think I have too many commas , or not , perhaps..'
Output:
['this', 'is', 'a', 'test', ' to see if you understand it', 'or', 'not', ' hmmm', 'I', 'think', 'I', 'have', 'too', 'many', 'commas', ' or not ', 'perhaps..']
Input:
D = ','; I = '"'; S = 'a,",",b,"c","d,e,,",f'
Output:
['a', ',', 'b', 'c', 'd,e,,', 'f']
Input:
D = ','; I = '"'; S = ',"a,b",c,,d,""'
Output:
['', 'a,b', 'c', '', 'd', '']
Input:
D = 'x'; I = 'y'; S = 'contains no lowercase X nor Y'
Output:
['contains no lowercase X nor Y']
Input:
D = ' '; I = 'I'; S = "I'll remove all I"
Output:
["", "'ll remove all ", ""]
Input:
D = '1'; I = '3'; S = '1358984197316913997510582097494459207831640628620894825421137067931'
Output: ['', '58984197', '69', '9975105820974944592078', '64062862089482542', '', '70679', '']
Input:
D = ' '; I = 'S'; S = 'regular split on spaces'
Output:
['regular', 'split', 'on', 'spaces']
code-golf string
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Inspired by this StackOverflow question.
Input:
We'll take three inputs:
- A delimiter-character
D
to split on - A character
I
within we ignore the character to split on (I know, that sounds vague, but I'll explain it below) - A string
S
Output:
A list/array containing the substrings after the split.
Example:
Input:
D = ','
I = '"'
S = '11020199,"Abc ",aduz,,444,bieb,dc,2 ,2222.00,whatever 5dc,222.22,22.00,"98,00","12,000,000",21-09-2018, 06:00,",-,"'
Output:
['11020199', 'Abc ', 'aduz', '', '444', 'bieb', 'dc', '2 ', '2222.00', 'whatever 5dc', '222.22', '22.00', '98,00', '12,000,000', '21-09-2018', ' 06:00', ',-,']
Why? Splitting on comma would normally also split 98,00
, 12,000,000
and ,-,
in two/three pieces. But because they are within the I
input character, we ignore ignore the split here.
Challenge rules:
- You can assume there will always be an even amount of
I
characters in the input-string. - You can assume the character
I
will always have aD
next to it (except when it's the first or last character of the input). So you won't have something likeD = ','; I = '"'; S = 'a,b"c,d"e,f'
. - The input-string
S
could contain none of eitherD
orI
. If it contains noD
, we output a list with the entire input-string as only item. - The output list won't contain the character
I
anymore, even when it contained noD
(as you can see at the"Abc "
becoming'Abc '
in the example above). - It is possible that the substring within
I
contains onlyD
. For example:D = ','; I = '"'; S = 'a,",",b,"c","d,e,,",f'
would result in['a', ',', 'b', 'c', 'd,e,,', 'f']
. - When an input has a leading or trailing
D
, or two adjacentD
, we'll have an empty item. I.e.D = ','; I = '"'; S = ',"a,b",c,,d,""'
would result in['', 'a,b', 'c', '', 'd', '']
. - You can assume the inputs and outputs will only contain printable ASCII in the range
[32, 126]
(so excluding tabs and newlines). - You are also allowed to output all items new-line delimited instead of returning/outputting a list/array (especially for those languages that don't have lists/arrays; i.e. Retina).
General rules:
- This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
Default Loopholes are forbidden.- If possible, please add a link with a test for your code (i.e. TIO).
- Also, adding an explanation for your answer is highly recommended.
Test cases:
Input:
D = ','; I = '"'; S = '11020199,"Abc ",aduz,,444,bieb,dc,2 ,2222.00,whatever 5dc,222.22,22.00,"98,00","12,000,000",21-09-2018, 06:00,",-,"'
Output:
['11020199', 'Abc ', 'aduz', '', '444', 'bieb', 'dc', '2 ', '2222.00', 'whatever 5dc', '222.22', '22.00', '98,00', '12,000,000', '21-09-2018', ' 06:00', ',-,']
Input:
D = ' '; I = ','; S = 'this is a test , to see if you understand it, or not , hmmm, I think I have too many commas , or not , perhaps..'
Output:
['this', 'is', 'a', 'test', ' to see if you understand it', 'or', 'not', ' hmmm', 'I', 'think', 'I', 'have', 'too', 'many', 'commas', ' or not ', 'perhaps..']
Input:
D = ','; I = '"'; S = 'a,",",b,"c","d,e,,",f'
Output:
['a', ',', 'b', 'c', 'd,e,,', 'f']
Input:
D = ','; I = '"'; S = ',"a,b",c,,d,""'
Output:
['', 'a,b', 'c', '', 'd', '']
Input:
D = 'x'; I = 'y'; S = 'contains no lowercase X nor Y'
Output:
['contains no lowercase X nor Y']
Input:
D = ' '; I = 'I'; S = "I'll remove all I"
Output:
["", "'ll remove all ", ""]
Input:
D = '1'; I = '3'; S = '1358984197316913997510582097494459207831640628620894825421137067931'
Output: ['', '58984197', '69', '9975105820974944592078', '64062862089482542', '', '70679', '']
Input:
D = ' '; I = 'S'; S = 'regular split on spaces'
Output:
['regular', 'split', 'on', 'spaces']
code-golf string
Inspired by this StackOverflow question.
Input:
We'll take three inputs:
- A delimiter-character
D
to split on - A character
I
within we ignore the character to split on (I know, that sounds vague, but I'll explain it below) - A string
S
Output:
A list/array containing the substrings after the split.
Example:
Input:
D = ','
I = '"'
S = '11020199,"Abc ",aduz,,444,bieb,dc,2 ,2222.00,whatever 5dc,222.22,22.00,"98,00","12,000,000",21-09-2018, 06:00,",-,"'
Output:
['11020199', 'Abc ', 'aduz', '', '444', 'bieb', 'dc', '2 ', '2222.00', 'whatever 5dc', '222.22', '22.00', '98,00', '12,000,000', '21-09-2018', ' 06:00', ',-,']
Why? Splitting on comma would normally also split 98,00
, 12,000,000
and ,-,
in two/three pieces. But because they are within the I
input character, we ignore ignore the split here.
Challenge rules:
- You can assume there will always be an even amount of
I
characters in the input-string. - You can assume the character
I
will always have aD
next to it (except when it's the first or last character of the input). So you won't have something likeD = ','; I = '"'; S = 'a,b"c,d"e,f'
. - The input-string
S
could contain none of eitherD
orI
. If it contains noD
, we output a list with the entire input-string as only item. - The output list won't contain the character
I
anymore, even when it contained noD
(as you can see at the"Abc "
becoming'Abc '
in the example above). - It is possible that the substring within
I
contains onlyD
. For example:D = ','; I = '"'; S = 'a,",",b,"c","d,e,,",f'
would result in['a', ',', 'b', 'c', 'd,e,,', 'f']
. - When an input has a leading or trailing
D
, or two adjacentD
, we'll have an empty item. I.e.D = ','; I = '"'; S = ',"a,b",c,,d,""'
would result in['', 'a,b', 'c', '', 'd', '']
. - You can assume the inputs and outputs will only contain printable ASCII in the range
[32, 126]
(so excluding tabs and newlines). - You are also allowed to output all items new-line delimited instead of returning/outputting a list/array (especially for those languages that don't have lists/arrays; i.e. Retina).
General rules:
- This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
Standard rules apply for your answer, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
Default Loopholes are forbidden.- If possible, please add a link with a test for your code (i.e. TIO).
- Also, adding an explanation for your answer is highly recommended.
Test cases:
Input:
D = ','; I = '"'; S = '11020199,"Abc ",aduz,,444,bieb,dc,2 ,2222.00,whatever 5dc,222.22,22.00,"98,00","12,000,000",21-09-2018, 06:00,",-,"'
Output:
['11020199', 'Abc ', 'aduz', '', '444', 'bieb', 'dc', '2 ', '2222.00', 'whatever 5dc', '222.22', '22.00', '98,00', '12,000,000', '21-09-2018', ' 06:00', ',-,']
Input:
D = ' '; I = ','; S = 'this is a test , to see if you understand it, or not , hmmm, I think I have too many commas , or not , perhaps..'
Output:
['this', 'is', 'a', 'test', ' to see if you understand it', 'or', 'not', ' hmmm', 'I', 'think', 'I', 'have', 'too', 'many', 'commas', ' or not ', 'perhaps..']
Input:
D = ','; I = '"'; S = 'a,",",b,"c","d,e,,",f'
Output:
['a', ',', 'b', 'c', 'd,e,,', 'f']
Input:
D = ','; I = '"'; S = ',"a,b",c,,d,""'
Output:
['', 'a,b', 'c', '', 'd', '']
Input:
D = 'x'; I = 'y'; S = 'contains no lowercase X nor Y'
Output:
['contains no lowercase X nor Y']
Input:
D = ' '; I = 'I'; S = "I'll remove all I"
Output:
["", "'ll remove all ", ""]
Input:
D = '1'; I = '3'; S = '1358984197316913997510582097494459207831640628620894825421137067931'
Output: ['', '58984197', '69', '9975105820974944592078', '64062862089482542', '', '70679', '']
Input:
D = ' '; I = 'S'; S = 'regular split on spaces'
Output:
['regular', 'split', 'on', 'spaces']
code-golf string
code-golf string
asked 43 mins ago


Kevin Cruijssen
32.5k554174
32.5k554174
add a comment |Â
add a comment |Â
4 Answers
4
active
oldest
votes
up vote
2
down vote
R, 19 bytes
Regular unmodified scan
with the appropriate arguments for text
, sep
and quote
should do it.
scan(,t=S,"",,,D,I)
Try it online!
(The ""
argument for what
could be modified to S
for -1, but in the interest of clarity, I've left as is.)
2
As usual, R leading the way on string splitting challenges.
– ngm
31 mins ago
2
Talk about the right language for the job. :) Verified a few test cases, and they all seem to work fine, so +1 from me. PS: Taking input by storing it in a variable isn't allowed according to the meta.
– Kevin Cruijssen
30 mins ago
I mean...scan
is a function already. I can prefix the thing withfunction(D, I, S)
if that's conformant, but really, this is how you'd call it anyway.
– J.Doe
28 mins ago
@KevinCruijssen Can I submitscan
for 4 bytes and then call it with the arguments in the appropriate places?
– J.Doe
6 mins ago
add a comment |Â
up vote
2
down vote
C (gcc), 64 bytes
c;f(d,i,s)char*s;c?*s:10);
Try it online!
add a comment |Â
up vote
0
down vote
Python 2, 71 bytes
D,I,S=input()
k=1
for p in S.split(I):print p.replace(D*k,'n'*k),;k^=1
Try it online!
add a comment |Â
up vote
-1
down vote
Python 3, 47 chars
''.join(list(filter(lambda x:x!=I,S))).split(D)
Try It Online!
New contributor
A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
R, 19 bytes
Regular unmodified scan
with the appropriate arguments for text
, sep
and quote
should do it.
scan(,t=S,"",,,D,I)
Try it online!
(The ""
argument for what
could be modified to S
for -1, but in the interest of clarity, I've left as is.)
2
As usual, R leading the way on string splitting challenges.
– ngm
31 mins ago
2
Talk about the right language for the job. :) Verified a few test cases, and they all seem to work fine, so +1 from me. PS: Taking input by storing it in a variable isn't allowed according to the meta.
– Kevin Cruijssen
30 mins ago
I mean...scan
is a function already. I can prefix the thing withfunction(D, I, S)
if that's conformant, but really, this is how you'd call it anyway.
– J.Doe
28 mins ago
@KevinCruijssen Can I submitscan
for 4 bytes and then call it with the arguments in the appropriate places?
– J.Doe
6 mins ago
add a comment |Â
up vote
2
down vote
R, 19 bytes
Regular unmodified scan
with the appropriate arguments for text
, sep
and quote
should do it.
scan(,t=S,"",,,D,I)
Try it online!
(The ""
argument for what
could be modified to S
for -1, but in the interest of clarity, I've left as is.)
2
As usual, R leading the way on string splitting challenges.
– ngm
31 mins ago
2
Talk about the right language for the job. :) Verified a few test cases, and they all seem to work fine, so +1 from me. PS: Taking input by storing it in a variable isn't allowed according to the meta.
– Kevin Cruijssen
30 mins ago
I mean...scan
is a function already. I can prefix the thing withfunction(D, I, S)
if that's conformant, but really, this is how you'd call it anyway.
– J.Doe
28 mins ago
@KevinCruijssen Can I submitscan
for 4 bytes and then call it with the arguments in the appropriate places?
– J.Doe
6 mins ago
add a comment |Â
up vote
2
down vote
up vote
2
down vote
R, 19 bytes
Regular unmodified scan
with the appropriate arguments for text
, sep
and quote
should do it.
scan(,t=S,"",,,D,I)
Try it online!
(The ""
argument for what
could be modified to S
for -1, but in the interest of clarity, I've left as is.)
R, 19 bytes
Regular unmodified scan
with the appropriate arguments for text
, sep
and quote
should do it.
scan(,t=S,"",,,D,I)
Try it online!
(The ""
argument for what
could be modified to S
for -1, but in the interest of clarity, I've left as is.)
answered 35 mins ago
J.Doe
1,791112
1,791112
2
As usual, R leading the way on string splitting challenges.
– ngm
31 mins ago
2
Talk about the right language for the job. :) Verified a few test cases, and they all seem to work fine, so +1 from me. PS: Taking input by storing it in a variable isn't allowed according to the meta.
– Kevin Cruijssen
30 mins ago
I mean...scan
is a function already. I can prefix the thing withfunction(D, I, S)
if that's conformant, but really, this is how you'd call it anyway.
– J.Doe
28 mins ago
@KevinCruijssen Can I submitscan
for 4 bytes and then call it with the arguments in the appropriate places?
– J.Doe
6 mins ago
add a comment |Â
2
As usual, R leading the way on string splitting challenges.
– ngm
31 mins ago
2
Talk about the right language for the job. :) Verified a few test cases, and they all seem to work fine, so +1 from me. PS: Taking input by storing it in a variable isn't allowed according to the meta.
– Kevin Cruijssen
30 mins ago
I mean...scan
is a function already. I can prefix the thing withfunction(D, I, S)
if that's conformant, but really, this is how you'd call it anyway.
– J.Doe
28 mins ago
@KevinCruijssen Can I submitscan
for 4 bytes and then call it with the arguments in the appropriate places?
– J.Doe
6 mins ago
2
2
As usual, R leading the way on string splitting challenges.
– ngm
31 mins ago
As usual, R leading the way on string splitting challenges.
– ngm
31 mins ago
2
2
Talk about the right language for the job. :) Verified a few test cases, and they all seem to work fine, so +1 from me. PS: Taking input by storing it in a variable isn't allowed according to the meta.
– Kevin Cruijssen
30 mins ago
Talk about the right language for the job. :) Verified a few test cases, and they all seem to work fine, so +1 from me. PS: Taking input by storing it in a variable isn't allowed according to the meta.
– Kevin Cruijssen
30 mins ago
I mean...
scan
is a function already. I can prefix the thing with function(D, I, S)
if that's conformant, but really, this is how you'd call it anyway.– J.Doe
28 mins ago
I mean...
scan
is a function already. I can prefix the thing with function(D, I, S)
if that's conformant, but really, this is how you'd call it anyway.– J.Doe
28 mins ago
@KevinCruijssen Can I submit
scan
for 4 bytes and then call it with the arguments in the appropriate places?– J.Doe
6 mins ago
@KevinCruijssen Can I submit
scan
for 4 bytes and then call it with the arguments in the appropriate places?– J.Doe
6 mins ago
add a comment |Â
up vote
2
down vote
C (gcc), 64 bytes
c;f(d,i,s)char*s;c?*s:10);
Try it online!
add a comment |Â
up vote
2
down vote
C (gcc), 64 bytes
c;f(d,i,s)char*s;c?*s:10);
Try it online!
add a comment |Â
up vote
2
down vote
up vote
2
down vote
C (gcc), 64 bytes
c;f(d,i,s)char*s;c?*s:10);
Try it online!
C (gcc), 64 bytes
c;f(d,i,s)char*s;c?*s:10);
Try it online!
answered 18 mins ago
l4m2
3,9581431
3,9581431
add a comment |Â
add a comment |Â
up vote
0
down vote
Python 2, 71 bytes
D,I,S=input()
k=1
for p in S.split(I):print p.replace(D*k,'n'*k),;k^=1
Try it online!
add a comment |Â
up vote
0
down vote
Python 2, 71 bytes
D,I,S=input()
k=1
for p in S.split(I):print p.replace(D*k,'n'*k),;k^=1
Try it online!
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Python 2, 71 bytes
D,I,S=input()
k=1
for p in S.split(I):print p.replace(D*k,'n'*k),;k^=1
Try it online!
Python 2, 71 bytes
D,I,S=input()
k=1
for p in S.split(I):print p.replace(D*k,'n'*k),;k^=1
Try it online!
answered 7 mins ago


Lynn
48.8k694223
48.8k694223
add a comment |Â
add a comment |Â
up vote
-1
down vote
Python 3, 47 chars
''.join(list(filter(lambda x:x!=I,S))).split(D)
Try It Online!
New contributor
A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
-1
down vote
Python 3, 47 chars
''.join(list(filter(lambda x:x!=I,S))).split(D)
Try It Online!
New contributor
A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
-1
down vote
up vote
-1
down vote
Python 3, 47 chars
''.join(list(filter(lambda x:x!=I,S))).split(D)
Try It Online!
New contributor
A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Python 3, 47 chars
''.join(list(filter(lambda x:x!=I,S))).split(D)
Try It Online!
New contributor
A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 1 min ago
New contributor
A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 12 mins ago
A.Aydin
1
1
New contributor
A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
A.Aydin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f174896%2fsplit-it-but-not-all%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password