# Questions tagged [string]

A competition to solve a particular problem through the usage and manipulation of strings.

1,546 questions
550 views

### XOR reduction bools

Description : Given a string of space separated binary digits or space separated booleans or an array of binary digits or array of booleans . Your job is to find the xor of each until you end up with ...
288 views

### Conway's game of life [duplicate]

Description : Given an array of strings representing a grid of cells With the key : 0 = 'dead cell' 1 = 'live cell' write a function that returns the next ...
358 views

### Sequence splitting [closed]

Given an arbitrary sequence consisting of 1 and A split this sequence up so that A is at the beginning of each sub sequence. Sequences without a leading A and Sequences without 1 before the next A ...
2k views

### Sort spelled-out serial numbers

Given a list of two or more spelled-out serial numbers of equal length greater than two, e.g. ...
994 views

### Join up the rooms

So, here's a map of, let's say, a dungeon... ########## # ##### # ##### ########## ########## ########## ########## #### ## #### ## ########## Let's ...
1k views

### Interval Notations

Challenge: Input: Two integer parameters a and b (where a<b and the difference is at ...
2k views

### Expand compressed brain-flak

This challenge was posted as part of the April 2018 LotM challenge, as well as for Brain-flak's 2nd birthday I was thinking about what the most efficient way to encode brain-flak programs would be. ...
215 views

### Simulating Crashing Cars

Introduction I have some ASCII cars that have velocity and direction. Their velocity is represented by their number. If a car is <> then it has stopped. For ...
10k views

### Facey McFaceface

Anyone remember Boaty? You could totally make any old word, right? Write a function to turn a string into Somethingy McSomethingface. It should accept one string as input. Ignore the case of the ...
1k views

### Almost a Columbo episode

Your task is to find two missing characters in a Columbo episode title. Input One of the 69 Columbo episode titles (as listed below), with exactly two characters replaced with ...
2k views

### Ten-pin bowling score - World Bowling edition

World Bowling scoring Many people have gone to their local bowling center to play a few games of bowling, and many people continue to struggle to calculate their scores. World Bowling has introduced ...
256 views

### “Hello, name!”; [duplicate]

Challenge Your challenge is to make a simple program that takes the [input] and formats it as "Hello, [input]!" Input Either a function call variable or STDIN, this is the name. Can contain any ...
3k views

### Shape Identifying Program

Your task is to build a program that identifies the shape of the input. The shapes to be identified can be any of the following: Square To be identified as a square, the source must have lines of ...
2k views

### Read color in my way

Different systems have different ways to describe colors, even if all of them are speaking in R-G-B-A space. A front-end developer who is familiar with CSS may prefer ...
5k views

### Shifting-Oriented Programming

A string can be shifted by a number n by getting the byte value c of each character in the string, calculating ...
234 views

### Print the largest String with the shortest Code [closed]

As the title says, your task is to print the largest string using the shortest code without taking any input value. Rules The program must take no input and print the largest string to STDOUT The ...
15k views

### No A, just CAPS LOCK

What happens when the CapsLock key on your keyboard doesn't have a notch in it? "This hPPENS." The goal of this program is to consistently emulate keyboard misses where each A press is replaced with ...
4k views

### Which Card is it?

Introduction Long ago, when I used to code card games with usual playing cards, I used to specify a number for each card and call a function with some number to get a card. This somewhat inspired me ...
412 views

### 𝘜𝘯𝘪𝘤𝘰𝘥𝘦 𝗠𝗮𝗿𝗸𝗱𝗼𝘄𝗻 F̲o̲r̲m̲a̲t̲t̲e̲r̲ (*Unicode* **Markdown** __Formatter__)

If you cannot see this post, you can use this image Your task is to create a markdown parser that outputs Unicode. It should support 𝗯𝗼𝗹𝗱, 𝘪𝘵𝘢𝘭𝘪𝘤, 𝙼𝚘𝚗𝚘𝚜𝚙𝚊𝚌𝚎, and 𝗎̲𝗇̲𝖽̲𝖾̲𝗋̲𝗅̲�...
419 views

### Help John watch movies!

Introduction So John finally has his holidays! And what better could he do than watching some movies. He indeed has a lot of movies to watch, but he is unable to decide which one to watch first. He ...
412 views

### Oops, I blew it up (with numbers)

Inspired by There, I fixed it (with rope), There, I fixed it (with Tape), There, I broke it (with scissors) Given a string with characters from a-z or ...
188 views

### Extract filename from path [duplicate]

Given a printable ASCII string representing a path to a file on a POSIX-compliant system, return just the filename, i.e. remove everything until and including the last slash (...
4k views

### There, I broke it (with scissors)

Challenge Given a string describing a cutting rule and another string, cut parts out of the second string using the rule described by the first string. Both strings will consist of letters ...
2k views

### There, I fixed it (with rope)

Related: Rather similar (but much easier) challenge horizontally: There I fixed it (with tape) Challenge: Given a string only containing upper- and/or lowercase letters (whichever you prefer) and ...
2k views

### We ended up where we started!…

Challenge: Input: You take two inputs: - A string only containing printable ASCII (excluding spaces, tabs or new-lines) - A printable ASCII character Output: The first line will contain the string-...
1k views

### Create this “String Mix-Up” function in as few bytes as possible

This is my first time here at Code Golf SE so feel free to add your input/advice/suggestions to improve my post if necessary. The week after my computer science exam, the solutions were publicly ...
4k views

### Woody words, tinny words

Note: There are some rude words in this question. There's an implicit puzzle posed in this classic Monty Python sketch (you can also ready the script online). Various phrases are described as being ...
364 views

### Compress to Impress

Inspired by both the challenge "Unique is Cheap" by @Laikoni, where the score is based on the challenge itself, as well as the JavaScript (ES6) answer of @ETHproductions for the "Palindrome ...
7k views

### There, I fixed it (with tape)

Challenge: Given a string only containing upper- and/or lowercase letters (whichever you prefer), put tape horizontally to fix it. We do this by checking the ...
1k views

### Balanced Zero-One Encoding

Task Encode a string that entirely consists of uppercase alphabets (A-Z) using only zeros and ones, using your own favorite scheme. But the rule isn't that simple! ...
1k views

### The greedy cutter

iBug recently got a long bar made of composite, yet valuable materials. The bar is so long that iBug can't easily sell it for credits, so he wants to cut it. The bar is made of such fragile and magic ...
11k views

### Non-discriminating Programming

We say a string is non-discriminating if each of the string's characters appears the same number of times and at least twice. Examples "aa!1 1 !a !1" is non-...
1k views

### Counting Sheep to Fall Asleep

Most people are familiar with the trope about counting sheep to fall asleep. There's a herd of sheep, some of them jumping over a fence, and you count the sheep as they jump. Supposedly, this helps ...
3k views

### Alphabet cannon

A cannonball is fired so that in the first eyeblink of its flight it ascends by N treetops, during the second eyeblink by N-1 ...
278 views

### Simplify and Take Partial Derivative to a Polynomial String

Introduction Write a program to calculate the partial derivative of a polynomial (possibly multivariate) with respect to a variable. Challenge Derivatives are very important mathematical tools that ...
410 views

### Shell Glob Golfing

This task is to output the shortest path to a file, after glob expansion. What is shell globbing? In most shells, you can use the * character in a path to ...
1k views

### Collapse the antistring

In this challenge you will be given an alphabetic string as input. We will define the "anti-string" of a given input to be the string with the case of all the letters inverted. For example ...
2k views

### Remove duplicates from a String

Inspired by this unassuming StackOverflow question. The idea is simple; given a String and an array of Strings, remove any instances of words in the array (ignoring case) from the input String other ...
3k views

### Split string on first occurrence of each character

Related. Given a printable ASCII string, split it into a list of non-empty strings with a new sub-string beginning every time a character, which has not previously been seen, occurs. Examples ...
578 views

### DNA to RNA Transcription

Guidelines Task Given a DNA strand, return its RNA complement (per RNA transcription). Both DNA and RNA strands are a sequence of nucleotides. The four nucleotides found in DNA are adenine (A), ...
622 views

Guidelines Task Write a function that takes in a sentence (a string, or list of characters) and reverses all the words that are greater than or equal to 5 in length. Examples ...
620 views

### Local periods of strings

Local periods Take a non-empty string s. The local period of s at index i is the smallest positive integer n such that for each 0 ≤ k < n, we have s[i+k] = s[i-n+k] whenever both sides are ...
7k views

### Kolmogorov shifter

Output or display the following three lines of text, exactly as they are shown below. A trailing newline is accepted. ...
365 views

### Length of the Longest Palindromic Substring [duplicate]

A palindrome is a string which is the same when read forwards and backwards. For example "racecar" is a palindrome, but "Racecar" is not. A substring is a contiguous set of characters in a larger ...
502 views

### Orient the Rubik's Cube

Introduction: I collect twisty puzzles, so I'm quite the fan of rubiks-cube-challenges (even though most are fairly difficult). So, let's try a fairly easy rubiks-cube-challenge for a change. When ...
765 views

### Let's Encrypt It!

Challenge The challenge is to encrypt a given string, using the rules as specified below. The string will only contain lowercase alphabets, digits, and/or blank spaces. Equivalent of a Character ...
588 views

### A Zealous “Quick Brown Fox” “Jumped” Along the Groovy Spiral

Introduction Write a program to output the outgoing spiral of the famous pangram following given rules. Challenge A pangram is a sentence using every letter of a given alphabet at least once. One ...
5k views

### Falcon Heavy stages

Choose a set of four bytes without replacement (i.e. no byte repeated), and not necessarily in any particular order, from any one of the following four sets: The characters of any one single-byte ...