Questions tagged [string]

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

Filter by
Sorted by
Tagged with
4 votes
2 answers
405 views

Give the minimum Levenshtein distance to a string that matches the regex

Your task, at the moment that you choose to accept it, is to write a program that, when given a string and a PCRE-regex, calculates the minimum Levenshtein distance to another string that matches the ...
user avatar
12 votes
22 answers
2k views

Park, Lake, Santa Fe [closed]

Given a long multi-sentence string, the goal is the count the occurrences of the following words: park, lake, ...
user avatar
  • 541
11 votes
32 answers
1k views

Index and return 3 characters

The challenge is simple: Read 3 letters from a system input¹ and convert them to numbers (A-1, B-2, C-3...Z-26)². Print each of those numbers in the order the ...
user avatar
  • 261
19 votes
5 answers
848 views

What if function application was right-associative?

Background In Haskell and many other functional languages, function application f(x) is simply written as f x. Also, this form ...
user avatar
  • 62.1k
26 votes
7 answers
2k views

Happy Birthday... caird coinheringaahing? ChartZ Belatedly?

When this question was posted, it was caird coinheringaahing's birthday! (source: 1, 2, 3, 4) (It was also World Emoji Day.) As a bit of some CGCC lore, caird's name came from a Jelly answer by Dennis ...
user avatar
  • 40.1k
6 votes
6 answers
385 views

Blinking Lighthouses – Founder's Day Upgrade

To celebrate the island's next Founder's Day, colored filters (fuchsia, chartreuse, and aquamarine*) have been installed in every lighthouse. All lighthouses begin operation with their fuchsia filter,...
user avatar
  • 616
16 votes
8 answers
761 views

Polyagony layout (mode 3/3,6)

Background Polyagony is a family of hypothetical esolangs where the source code is laid out on a specifically shaped board before running it. It's similar to Hexagony, but various uniform tilings can ...
user avatar
  • 62.1k
20 votes
5 answers
2k views

KEYBOARD FOR MONKE!

Flavortext So...this is awkward. It seems I accidentally turned into a monkey last night after eating one too many banana sundaes. This has made many things inconvenient, especially typing. You see, ...
user avatar
  • 9,266
10 votes
44 answers
2k views

Which character to change (Robbers)

Cops thread Robbers, your task is to crack a cops answer. Reveal the character that should be changed and what it should be changed to too. Please notify the cop if you cracked their challenge. The ...
user avatar
  • 3,585
20 votes
49 answers
3k views

Which character to change (Cops)

Robbers Thread Cops, your task is to chose a program that prints a string (you can choose). Although, if you change 1 character in your code, it should print another string. But there's a twist: You ...
user avatar
  • 3,585
23 votes
8 answers
2k views

Blinking Lighthouses

Lighthouses on an island have blink codes that let ships know which lighthouse they are seeing. Input should be strings of S and L. Here is a (Python) example of codes for 4 lighthouses as a list of ...
user avatar
  • 616
7 votes
25 answers
3k views

Generate this huge right triangle

Your task is to print out this exact text: ...
user avatar
  • 153
26 votes
17 answers
1k views

r flag my Vyxal

Vyxal is a stack-based language, meaning that everything operates by popping and pushing values onto a stack. It has a bunch of useful flags, one of which is r. ...
user avatar
  • 26.8k
25 votes
23 answers
2k views

Help Alice fix her text!

When Alice was touch typing on her QWERTY keyboard (Figure 1), she accidentally shifted both of her hands rightwards by one key, so q became ...
user avatar
  • 48.2k
8 votes
7 answers
467 views

Fix Facebook exported JSON

When you export data in JSON from Facebook, the multi-byte Unicode characters are broken. Example Unicode characters and their representation inside JSON: ...
user avatar
12 votes
4 answers
574 views

Leave the times out!

Everyone knows, that you can leave out the multiplication symbol (\$\times\$, or *) in a*b ...
user avatar
  • 3,585
19 votes
21 answers
3k views

Draw a mountain given altitude

Take an array of nonnegative integers, such as [1, 0, 0, 1, 2, 4, 2, 0]. Then, draw that as a mountain where the integers represent altitude: ...
user avatar
18 votes
11 answers
2k views

Count my Pluses

Your task is, to count how many pluses I have. What Pluses? The no plus: 0 Points - The naïve Plus: 1 Point + The double ...
user avatar
  • 3,585
1 vote
0 answers
54 views

Reverse a sentence word by word [duplicate]

The setting "Well I actually wrote the sql library they, the maintainers actually.." "Right, but do you have any experience working with django?" " ...no I don't use ...
user avatar
  • 111
19 votes
11 answers
1k views

Print instructions for typing \` in chat

Background As far as we can tell from trying everything (besides cheating with ZWSPs), you can't type `\ in Stack Exchange chat. However, you can type ...
user avatar
  • 40.1k
16 votes
7 answers
1k views

Drop some boxes

Say I have a pile of boxes: AAA BBB I can create it in two steps: BBB ↓ (empty) --- AAA ↓ BBB But with this: ...
user avatar
  • 26.8k
7 votes
1 answer
174 views

Jump trajectory

This is an ascii-art challenge where you will draw ascii-art showing a person "jumping" off the top of a building. The building Input given will be a group of rectangular buildings. You may ...
user avatar
51 votes
11 answers
4k views

Write a C++ demangler

If you have ever looked at an objdump of a C++ program, you have likely seen something like this: _ZN3foo3bar3bazI6sampleEE3quxvi3foo This is a C++ mangled symbol, ...
user avatar
  • 4,100
14 votes
8 answers
2k views

Visualize a Risky program

Risky is a new language of mine, which features an interesting form of tacit programming. In this challenge, you'll take a Risky program as input, and visualize the parsing. No knowledge of Risky is ...
user avatar
17 votes
12 answers
2k views

Remove All Smalltalk Comments for Code Golf

Take a line of input (function arguments or stdin, etc.). Remove comments in it, where a comment starts and ends with ". Do not remove comments in string ...
user avatar
10 votes
5 answers
419 views

Rewrite strings without changing their order

Lexicographic Ordering For this challenge we will be talking about the lexicographic ordering of strings. If you know how to put words in alphabetical order you already understand the basic idea of ...
user avatar
  • 84.4k
14 votes
8 answers
777 views

Simplify K combinatory logic expression

Background Combinatory logic is a system where a term is written using a finite set of combinators and function application between terms, and reduction rules are defined for each combinator. The well-...
user avatar
  • 62.1k
19 votes
11 answers
4k views

I'm Lazy: Close my Superparens

Picolisp has a feature called "super parentheses": Brackets ('[' and ']') can be used as super parentheses. A closing bracket will match [all parentheses to and including] the innermost ...
user avatar
13 votes
8 answers
1k views

Is this FEN board a Fischer random chess starting board?

Introduction Fischer random chess, also known as Chess960 for the 960 valid starting boards, is a variant of chess where each player's pieces are randomly shuffled at the start. As a reminder, each ...
user avatar
  • 10.9k
31 votes
48 answers
2k views

Split a list at the second occurrence of the first element

Why should you golf in Haskell? Find out here. In that answer, Zgarb defines a task: Let's define a function f that splits a list at the second occurrence of the ...
user avatar
6 votes
4 answers
260 views

Ambiguous Chemical Formula

If you convert a chemical formula to lower case, it may become ambiguous: co can be both CO or ...
user avatar
  • 12.7k
26 votes
21 answers
3k views

I'm Lazy*: Top-left align my text

* and don't have a word processor with top-left align support :D Take several lines of input, with at least four unique characters of your choice including newline and space. The input can also be ...
user avatar
12 votes
8 answers
2k views

Generate a British numberplate

Modern British number plates (a.k.a. registration marks or license plates) use the format AANNXXX where AA is a "DVLA ...
user avatar
  • 18.2k
24 votes
25 answers
1k views

Multiply elements of the dihedral group

This is a copy cat question of Simplify ijk string applied to the other nonabelian group of order 8. See also Dihedral group composition with custom labels. Challenge Given a string made of ...
user avatar
  • 2,075
21 votes
20 answers
3k views

Gödel numbering of a string

Background Gödel numbers are a way of encoding any string with a unique positive integer, using prime factorisations: First, each symbol in the alphabet is assigned a predetermined integer code. Then, ...
user avatar
  • 18.2k
45 votes
27 answers
2k views

Simplify ijk-string

Related: Multiply Quaternions Challenge Given a string made of ijk, interpret it as the product of imaginary units of quaternion and simplify it into one of the ...
user avatar
  • 62.1k
9 votes
2 answers
319 views

Bring my memories about Geronimo Stilton back

If you have read in your childhood a Geronimo Stilton's book i am sure that you remember the style of the text, sometimes the words was decorated for making the act of reading more funny for kids, ...
user avatar
15 votes
15 answers
1k views

Convert version string to pack_format

When making a Minecraft data/resource pack, you need to include a pack.mcmeta file, which specifies information about it. ...
user avatar
24 votes
18 answers
2k views

Random Move 2x2 Scrambling

A simple way to scramble a 2x2x2 Rubik's cube is to make a sequence random moves. This is not how official scrambles are done, but can get pretty close to a uniform distribution of all possible ...
user avatar
  • 10.9k
9 votes
1 answer
171 views

Are We Fast And Furious? [closed]

There are currently nine feature length films in the core Fast & Furious/The Fast and the Furious media franchise, a series of films about bald men scowling and driving cars very fast. The names ...
user avatar
17 votes
14 answers
968 views

Implement swap encoding

Swap encoding is an encoding method where you iterate through a string, reversing sections of it between pairs of identical characters. The basic algorithm For each character in the string: Check: ...
user avatar
  • 26.8k
10 votes
1 answer
273 views

CDGLF: TMN to APL

In this challenge you will remove one of my least favorite features, operator precedence from traditional math notation, to acheive the syntax of one of my favorite languages, APL. The APL subset we ...
user avatar
26 votes
5 answers
2k views

I before E, except after C

You may be aware of the famous old rhyme, "I before E, except after C". It is a rule taught to aid in the spelling of certain English words. Quoting Wikipedia: If one is not sure whether a ...
user avatar
  • 16.9k
11 votes
3 answers
343 views

Help me count the Omer

During the 49 days between Passover and Pentecost, Jewish liturgy provides four numerical problems that I've here phrased as code golf problems. Input/Arguments These four, in any order, and by any ...
user avatar
  • 27.1k
25 votes
24 answers
2k views

Help me get the day of the week correct

Sometimes, I will think it is one day of the week (e.g Friday) when in reality, it's earlier in the week (e.g Tuesday). Your challenge is to display the number of days my estimates are off by. ...
user avatar
  • 20.9k
19 votes
17 answers
732 views

Convert superscripts to MathJax

CGCC hasn't always had MathJax. Back in the dark ages, it would have been necessary to write \$x^2\$ as (the horror!). In this challenge, you will be given some ...
user avatar
18 votes
19 answers
3k views

Did I die or not?

Given a permutation of the alphabet and an intended "word", determine if the word was guessed in a game of Hangman, where the permutation is the list of guesses. For example, given ...
user avatar
17 votes
23 answers
1k views

Reversencode the given string

Given a string, if it is even, break the string into 2 even parts, then reverse the parts to get the "reversencoded" string. Example: onomatopoeia -> tamonoaieopo If the string is not of ...
user avatar
17 votes
1 answer
531 views

Golfing Expressions

We can write mathematical expressions using the standard math operators (,),+,...
user avatar
  • 271
9 votes
3 answers
274 views

Interpret control characters like a terminal

Given a ASCII string containing control characters, compute what it should look like when printed to a terminal. Imagining the behaviour of a cursor, this is how to treat each character in the input: ...
user avatar
  • 18.2k

1 2
3
4 5
42