Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [substitution]

Substitution is the act of replacing one part of a string with another.

24
votes
38answers
2k views

Enumerate each series of identical numbers in-place

Given a list of strictly positive integers, go through each distinct number and replace all occurrences of it with successive indices (zero or one based) of a new series. Examples ...
29
votes
15answers
3k views

Fridge magnet substitution

When writing a message with fridge magnets, you'll often find yourself substituting a 1 for an I. In this challenge, your goal ...
11
votes
18answers
1k views

Fill in the Blanks, Please!

(No, not this nor any of these) Given a string and a list of strings, fill in the all blanks in the input string with corresponding strings. Input/Output The input string contains only alphabetic ...
3
votes
2answers
177 views

Create an auto-cucumber program [duplicate]

Oops, Auto-correct. You have a word. But it's wrong. You wonder what word it would be. Thankfully, being a code golfer, You can make a code to take a rough guess. I/O You will be given a (wrong, ...
22
votes
13answers
1k views

Collapse consecutive integers

Related: Tell me how many math problems I have to do! Challenge Given a strictly positive strictly ascending integer list L and an integer 3 ≤ N ≤ length of L, replace the middle integers of L's ...
7
votes
5answers
574 views

Trivial Brainf**k Substitution Interpreter

Brainf**k is the most famous esoteric programming language and is the inspiration for hundreds of other esoteric languages. In fact, there are quite a few languages that are so heavily based off of ...
78
votes
39answers
13k views

What my dog really hears

My dog is called Rex. Every time I scold him, he seems not very impressed and the only times I see him react is when I pronounce his name. If I say ...
26
votes
22answers
2k views

Recursive string substitution

The task Write a program or function that given three strings A, B, C produces an output string where each instance of B in <...
22
votes
17answers
2k views

Neutralize data

To neutralize data, recursively replace all numbers (not digits!) with zeros and all characters (not strings!) with spaces. You must accept any single number, character, or string, or possibly ...
-4
votes
3answers
157 views

Substring Substitution

Challenge Implement a program that given three strings a, b, and c, substitutes all ...