Questions tagged [string]

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

Filter by
Sorted by
Tagged with
2
votes
10answers
110 views

Put in the quotes

Add double-quotes (") in order to surround a word (i.e. something that matches [a-z]+). ...
5
votes
11answers
173 views

Creating words by structure [closed]

Context As a conlanger, I am interested in creating a uniform, naturalistic language. One of the tricks is to create vocabulary according to certain structures of words. An example from English: In ...
14
votes
10answers
2k views

Visualize a Recursive Acronym

Background Famously, the acronym GNU stands for GNU's Not Unix. 1 It's recursive because, after expanding it once, it still ...
23
votes
21answers
3k views

The most common substring

The purpose of this task is to write a program or function to find the most common substring within a given string, of the specified length. Inputs A string, s, ...
0
votes
0answers
49 views

code-bowlingn't [duplicate]

If you place the suffix n't on any given word, it instantly means the opposite of the intended usage of the word. If you place the word ...
3
votes
7answers
191 views

String permutations

Print the biggest-size subset of strings in the input that are all permutations of each other. If there are ties, any one will do. If no strings are permutations of each other (for example, only one ...
21
votes
17answers
2k views

Answer templating

Context Just look around! Whenever someone posts an answer, the same template is followed over and over again! A first line with the byte count and language name. Then the code. Then the TIO link. ...
2
votes
0answers
97 views

Predictor Generator [closed]

Write a program that when given a string \$S\$, it generates a program of the same language as itself. The generated program, when given a continuous substring of \$S\$, should predict the next ...
4
votes
5answers
280 views

Find the most important character

Find the most important character The challenge is to write a program that outputs the most occurrent character in the input string, excluding these bracketing characters ...
1
vote
1answer
128 views

Name an arbitrary string [closed]

This should be easy: given an arbitrary string, your program will give it a name. Requirements Your program will accept an input of a UTF8 string, and output a string representing the input's "name",...
3
votes
5answers
259 views

Implement a Caesar Cipher with a Digit Shift

I assume everyone here is familiar with the Caesar Cipher that shifts letters to a certain index. https://en.wikipedia.org/wiki/Caesar_cipher for those who still needs introduction. But, we can all ...
27
votes
25answers
2k views

The Magical Piper

An old test for programmers, taken from here (Note: in italian). Along a road (denoted by '_'), there is a Magical Piper (denoted by '...
29
votes
19answers
4k views

Print this maximally long URL

Task This one is simple. We want to compress a URL, but don't trust URL shorteners. Write a program that prints to stdout (or a 0-argument function that returns) the following, working URL: http://...
4
votes
3answers
181 views

Shortest POSIX command line that eagerly removes dual newline sequences

Example: echo -ne 'a\n\nb\nc\n\n\n\nd\n\n\n' | your-command should output the same as echo -ne 'ab\ncd\n' Watch out, some ...
15
votes
25answers
1k views

pleTriwapt Sgpin (Triplet Swapping)

Intro/Background I was looking at a Flybuys card at Coles recently and noticed that if I took something like this: Source, randomly found on the Internet And swapped some words around, I'd get ...
27
votes
63answers
3k views
+150

Repeat every other character in string starting with second character

Requirements: Take a single word as input with only lowercase alphabetical characters (a-z) Output a string where every other character is repeated, with the first repeated character being the second ...
11
votes
1answer
305 views

Write a Whitespace Interpreter

Challenge: Your challenge is to write an interpreter for Whitespace. Given a string consisting of spaces, tabs, newlines, and potential other characters, as well as possible inputs for the Whitespace ...
43
votes
11answers
4k views

Simple Circular Words

A "simple circular" word is a word whose chords do not intersect. The chords of a word may be seen by laying out the alphabet in a circle, and then connecting the word's consecutive letters. ...
19
votes
8answers
2k views

Narcissistic Quine

Write a program/method that: Becomes a quine when the input matches the source code; Doesn't halt otherwise. This is code-golf, so shortest solution wins. Avoid any standard loopholes.
20
votes
19answers
2k views

Super permutations

Super permutations Input: A string The program should loop through all lengths of the input (decrementing one each time), generate all combinations with replacement of the string, then make ...
14
votes
1answer
382 views

Is everything in order?

Challenge: Input: a string, consisting of only printable ASCII characters Output: a truthy/falsey value whether its characters are in alphabetical order (based on their UTF-8 unicode values), from ...
13
votes
4answers
538 views

Keta Bracket Autocompletion

Special thanks to Bubbler and AdmBorkBork for supplying feedback about this challenge Keta (Keyboard tacit — clever naming, I know!) is a golfing language I’ve been working on recently. One of it’s ...
7
votes
1answer
496 views

Average number of strings with Levenshtein distance up to 4

This is a version of this question which should not have such a straightforward solution and so should be more of an interesting coding challenge. It seems, for example, very likely there is no easy ...
-3
votes
5answers
243 views

Signpost reading [closed]

Challenge source: My: https://testovac.ksp.sk/tasks/ls18-signpost/download/ dated 11. 7. 2016 SPOJ: https://www.spoj.com/problems/SIGNPOST/ dated 2018-03-22 Challenge definition == Example input/...
2
votes
3answers
193 views

Partial tq interpreter

In this task you are expected to provide a list output given an input tq program. The tq programs will not contain whitespace inside them. What is tq, in the first place? tq is a lazy-evaluated ...
-2
votes
2answers
237 views

Shorten String as Much as Possible [closed]

Introduction In a list of strings, there is a certain length you can shorten strings to before they become indistinguishable. This is a pretty bad explanation, so here is an example. ...
11
votes
4answers
2k views

Can you calculate the average Levenshtein distance exactly?

The Levenshtein distance between two strings is the minimum number of single character insertions, deletions, or substitutions to convert one string into the other one. The challenge is to compute ...
6
votes
1answer
566 views

Average number of strings with Levenshtein distance up to 3

The Levenshtein distance between two strings is the minimum number of single character insertions, deletions, or substitutions to convert one string into the other one. Given a binary string \$S\$ of ...
28
votes
37answers
2k views

CahartcreS awppnig (Character Swapping)

Intro/Background I was looking at "You Had One Job" pictures lately, and noticed an old favourite of mine: And I said to myself: "I need a program that can generate text like that". So I devised a ...
5
votes
11answers
777 views

Reversing and Shifting

Sandbox Adapted from exercise 8 of 100 little Keg exercises String manipulation is a very important part of any programming language. Consequently, that is what this challenge is about. The ...
9
votes
11answers
543 views

Convert Character Substrings to Numeric

I often have to take character data and categorize it numerically at work. A common thing I do is to take character type variables and convert them to numeric type characters, keeping same categories ...
4
votes
11answers
824 views

Even-Odd chunks

(Inspired by the Keg utility of this challenge) Given a non-empty input string, e.g. s c 1= e(a"E"), split the input into even-odd chunks. Example (Feel free to ...
17
votes
10answers
1k views

Fill the Golfeek gutter

Golfeek is the working name of an esolang I'm occasionally working on. One distinctive feature of this language is that each statement is encoded as a sequence of bits rather than a sequence of bytes. ...
20
votes
4answers
422 views

Hexagonify™ a String Block

Sandbox What is Hexagonification™? Hexagonification™ is a transformation that creates a hexagon with 3 copies of a rectangle block, each skewed to the right by 30 degrees and then ...
22
votes
19answers
6k views

I shift the source code, you shift the input!

Sandbox A spin-off of a rip-off of a rip-off of a rip-off of a rip-off. Go upvote those! Your task, if you accept it, is to write a program/function that outputs/returns its input/argument. The ...
0
votes
1answer
184 views

Chopping Unicode Bytes [closed]

Introduction Each Unicode codepoint can be represented as a sequence of up to 4 bytes. Because of this, it is possible to interpret some 2, 3, or 4-byte characters as multiple 1-byte characters. (See ...
3
votes
3answers
195 views

snakes_are_bad, camelsAreBetter [duplicate]

Introduction All these snakes everywhere! I've had enough, and have decided that I much prefer camels. Therefore, I want you to convert my snakes to camels for me. Challenge Turn any ...
24
votes
42answers
9k views

Make me speak L33T

I want to be down with the kids of the 1990's and start speaking this L33T speak of their's. For any given input I would like the resulting L33T speech as an output. I don't want to go to far down ...
20
votes
9answers
2k views

Substitute Unprintable ASCII Characters

Sandbox Have y'all ever written an answer with unprintable ASCII characters in it and wished that there was an easy way to represent those characters in a printable way? Well, that's why the Control ...
23
votes
14answers
3k views

ASCII texturing

Write a function or a full program that applies an ASCII texture to a 2d shape. Inputs: shape, texture, dimensions(optionally). Both Shape and Texture can be given by any convenient method (2d ...
25
votes
35answers
2k views

Sort and Table a Sentence by Word Lengths

In as few bytes as possible, sort the input, a delimited string OR list/vector/array of words, words contain printable ASCII except space (ASCII values 33-126) into a numbered list, table, or ...
12
votes
2answers
448 views

Exploding Primes

At the time of writing this puzzle, there are soon to be 269 puzzles related to primes. To celebrate/mourn this event (269 is prime), this challenge will be about exploding primes. In preparation for ...
3
votes
0answers
63 views

Counting syllables [duplicate]

Challenge Write code that, given an English word, outputs the number of syllables it has. Scoring will be determined by a combination of code length and accuracy. Rules The accuracy of the ...
18
votes
5answers
3k views

Format a Swedish phone number

In some parts of the world, phone numbers are fixed-length, apparently. That sounds boring, though. For this challenge, your task is to take the digits of a what is presumed to be a valid phone ...
3
votes
5answers
232 views

Proportion of strings with ascending letters [closed]

Challenge Construct n strings, each with three distinct letters, chosen randomly with equal probability. Print the proportion ...
16
votes
61answers
4k views

Average Two Letters

Introduction Every letter in the English alphabet can be represented as an ASCII code. For example, a is 97, and ...
32
votes
12answers
3k views

What is my volume?

Given an input integer, output the volume corresponding to the value. The value will always be in the range \$[0,100]\$. Examples If the input \$=0\$: ...
29
votes
12answers
4k views

Identify the Eeveelutions

Gah! It's a shame that Pokémon Sword and Shield won't introduce a new eeveelution. Let's mourn them with a code golf. The objective is to, when given a type name as the input, output the name of the ...
-5
votes
2answers
265 views

Fastest N times Hello World (Java/C/ C++) [closed]

Not a new one: Input N, being n, 0 ≤ n ≤ 5. Output N times "Hello World." Example: Input 3 Output Hello World. Hello World. Hello World. These 2 are my ...
14
votes
23answers
4k views

Making Sandwiches

Introduction Bob runs a deli. His deli serves sandwiches to its customers. However, it is a bit unusual. At Bob's deli, instead of telling Bob what they want, customers show Bob an ASCII art drawing ...

1 2 3 4 5 35