Skip to main content
Commonmark migration
Source Link

Your task is to write a program that will filter out some characters in a string, so that the remaining spells out (part of) the other string.

Let's say we received the string "123456781234567812345678", and the second string is "314159".

First, we put a pointer on the second string:

314159
^

So the pointer is now on 3, and we replace the not-3 characters with a hashtag until the first 3:

##3456781234567812345678

We then move the pointer to the next character until we have iterated through the string.

#Specs

Specs

  • You may use any character to replace "#", and the first string will not contain the hashtag (or the replaced hashtag).
  • The second string will always be longer than enough.
  • Both strings will only contain ASCII printable characters (U+0020-U+007F).

#Testcases

Testcases

input1: 123456781234567812345678
input2: 314159
output: ##3#####1##4####1###5###

input1: abcdefghijklmnopqrstuvwxyz
input2: dilemma
output: ###d####i##l##############

Your task is to write a program that will filter out some characters in a string, so that the remaining spells out (part of) the other string.

Let's say we received the string "123456781234567812345678", and the second string is "314159".

First, we put a pointer on the second string:

314159
^

So the pointer is now on 3, and we replace the not-3 characters with a hashtag until the first 3:

##3456781234567812345678

We then move the pointer to the next character until we have iterated through the string.

#Specs

  • You may use any character to replace "#", and the first string will not contain the hashtag (or the replaced hashtag).
  • The second string will always be longer than enough.
  • Both strings will only contain ASCII printable characters (U+0020-U+007F).

#Testcases

input1: 123456781234567812345678
input2: 314159
output: ##3#####1##4####1###5###

input1: abcdefghijklmnopqrstuvwxyz
input2: dilemma
output: ###d####i##l##############

Your task is to write a program that will filter out some characters in a string, so that the remaining spells out (part of) the other string.

Let's say we received the string "123456781234567812345678", and the second string is "314159".

First, we put a pointer on the second string:

314159
^

So the pointer is now on 3, and we replace the not-3 characters with a hashtag until the first 3:

##3456781234567812345678

We then move the pointer to the next character until we have iterated through the string.

Specs

  • You may use any character to replace "#", and the first string will not contain the hashtag (or the replaced hashtag).
  • The second string will always be longer than enough.
  • Both strings will only contain ASCII printable characters (U+0020-U+007F).

Testcases

input1: 123456781234567812345678
input2: 314159
output: ##3#####1##4####1###5###

input1: abcdefghijklmnopqrstuvwxyz
input2: dilemma
output: ###d####i##l##############
Tweeted twitter.com/StackCodeGolf/status/729397960522530822
Post Reopened by Adnan, Leaky Nun, user45941, Qwertiy, Denker
added 254 characters in body; edited title
Source Link
Leaky Nun
  • 50.1k
  • 6
  • 110
  • 284

Filter out the non-pithis string!

Your task is to write a program that will filter out those who do not belong to pi.

You may use an estimate tosome characters in a string, so that the valueremaining spells out (part of pi if it cannot be done. 355/113 would be a good estimate) the other string.

Let's say we received the string "123456781234577812345678""123456781234567812345678", and the second string is "314159".

We also haveFirst, we put a pointer on pithe second string:

314159265...314159
^

So the pointer is now on 3, and we replace the not-3 characters with a hashtag until the first 3:

##3456781234567812345678

We then move the pointer to the next digitcharacter until we have iterated through the string.

#Specs

You may use any non numeral character to replace #.

  • You may use any character to replace "#", and the first string will not contain the hashtag (or the replaced hashtag).
  • The second string will always be longer than enough.
  • Both strings will only contain ASCII printable characters (U+0020-U+007F).

#Testcases

inputinput1:  123456781234567812345678
input2: 314159
output: ##3#####1##4####1###5###

input1: abcdefghijklmnopqrstuvwxyz
input2: dilemma
output: ###d####i##l##############

Filter out the non-pi!

Your task is to write a program that will filter out those who do not belong to pi.

You may use an estimate to the value of pi if it cannot be done. 355/113 would be a good estimate.

Let's say we received the string "123456781234577812345678".

We also have a pointer on pi:

314159265...
^

So the pointer is now on 3, and we replace the not-3 characters with a hashtag until the first 3:

##3456781234567812345678

We then move the pointer to the next digit until we have iterated through the string.

#Specs

You may use any non numeral character to replace #.

#Testcases

input:  123456781234567812345678
output: ##3#####1##4####1###5###

Filter this string!

Your task is to write a program that will filter out some characters in a string, so that the remaining spells out (part of) the other string.

Let's say we received the string "123456781234567812345678", and the second string is "314159".

First, we put a pointer on the second string:

314159
^

So the pointer is now on 3, and we replace the not-3 characters with a hashtag until the first 3:

##3456781234567812345678

We then move the pointer to the next character until we have iterated through the string.

#Specs

  • You may use any character to replace "#", and the first string will not contain the hashtag (or the replaced hashtag).
  • The second string will always be longer than enough.
  • Both strings will only contain ASCII printable characters (U+0020-U+007F).

#Testcases

input1: 123456781234567812345678
input2: 314159
output: ##3#####1##4####1###5###

input1: abcdefghijklmnopqrstuvwxyz
input2: dilemma
output: ###d####i##l##############
Post Closed as "Needs details or clarity" by trichoplax is on Codidact now, Zach Gates, rink.attendant.6, Adnan, Suever
Post Reopened by Alex A.
added 412 characters in body
Source Link
Leaky Nun
  • 50.1k
  • 6
  • 110
  • 284

Your task is to write a program that will filter out those who do not belong to pi.

You may use an estimate to the value of pi if it cannot be done. 355/113 would be a good estimate.

Let's say we received the string "123456781234577812345678".

We also have a pointer on pi:

314159265...
^

So the pointer is now on 3, and we replace the not-3 characters with a hashtag until the first 3:

##3456781234567812345678

We then move the pointer to the next digit until we have iterated through the string.

#Specs

You may use any non numeral character to replace #.

#Testcases

input:  123456781234567812345678
output: ##3#####1##4####1###5###

Your task is to write a program that will filter out those who do not belong to pi.

You may use an estimate to the value of pi if it cannot be done. 355/113 would be a good estimate.

#Testcases

input:  123456781234567812345678
output: ##3#####1##4####1###5###

Your task is to write a program that will filter out those who do not belong to pi.

You may use an estimate to the value of pi if it cannot be done. 355/113 would be a good estimate.

Let's say we received the string "123456781234577812345678".

We also have a pointer on pi:

314159265...
^

So the pointer is now on 3, and we replace the not-3 characters with a hashtag until the first 3:

##3456781234567812345678

We then move the pointer to the next digit until we have iterated through the string.

#Specs

You may use any non numeral character to replace #.

#Testcases

input:  123456781234567812345678
output: ##3#####1##4####1###5###
Post Closed as "Needs details or clarity" by Alex A.
Source Link
Leaky Nun
  • 50.1k
  • 6
  • 110
  • 284
Loading