Questions tagged [string]

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

Filter by
Sorted by
Tagged with
15 votes
4 answers
325 views

Sides of a polygon

Given an ASCII-art shape made of the characters /\|_, your challenge is to return the number of sides it has. A side is a straight line of one of those, for example:...
8 votes
4 answers
221 views

Split along groups (hard mode)

This is an alternate version of this earlier challenge with a twist that adds a significant bit of difficulty. Like last time, you are going to be given a string containing some alphabetic characters ...
  • 90.5k
-3 votes
5 answers
187 views

Rotate a grid 90 degrees clockwise

The task is simple, given an integer n of how many lines the next n lines is and, a multi-line input, output the resulting 90 ...
  • 3,219
17 votes
6 answers
1k views

Is this continuous terrain?

Very related You're given a piece of ASCII art representing a piece of land, like so: /‾\ __/ ‾\_ \_/‾\ \ Since an overline (...
19 votes
10 answers
515 views

Split along groups

You are going to be given a string containing some alphabetic characters along with [ and ]. Your task is to split into ...
  • 90.5k
22 votes
43 answers
3k views

Is it a pure word?

Introduction A pure word (or perfect word), as defined by me, is a word where the sum of the position in the alphabet of each letter in the word is perfectly divisible by the total length of the word. ...
  • 3,560
10 votes
8 answers
602 views

Expand a Rubik's Cube Commutator

Background We will be using a 3x3 cube for this challenge. Rubik's cubers have their own notation for movements on the cube: Each of the 6 faces has a clockwise turn notated with a single capital ...
  • 3,593
19 votes
8 answers
451 views

Fill the (possibly leaky) bowl

Challenge: Given an ASCII art of a (possibly leaky) bowl consisting of a random distinct non-whitespace and non-~ character, fill it completely with ...
18 votes
28 answers
3k views

Make every other vowel uppercase

Given a lower case string. Ex: s = 'abcdefghijklmnopqrstuvwxyz' The goal is to make every other vowel uppercase. Desired output here: ...
  • 1,099
24 votes
27 answers
1k views

Check if the string is reshaped

Challenge Given an input string X, determine if X can be obtained from reshaping a strict prefix of itself (a prefix that is not ...
  • 2,551
20 votes
13 answers
627 views

Self-unshuffling strings

To shuffle a string \$s\$, Alice applies the following algorithm: She takes the ASCII code of each character, e.g. "GOLF" → \$[ 71, 79, 76, 70 ]\$ She ...
  • 171k
10 votes
11 answers
361 views

AoCG2021 Day 18: Stripping Strips

Part of Advent of Code Golf 2021 event. See the linked meta post for details. The story continues from AoC2018 Day 3. But you're not Bubbler, you're Lyxal! yeah, I know. After a long period of chaos, ...
  • 23.8k
25 votes
7 answers
804 views

Stitch a hitomezashi pattern

Challenge Given two binary vectors (containing two consistent values of your choice) of length \$n\$ and \$m\$, output a corresponding ascii-art hitomezashi stitching pattern. You are to fill the ...
  • 12.4k
8 votes
14 answers
707 views

Get all binary between a binary string and its reverse

Your Challenge is to take a binary string as input and get all binary numbers between itself and the reverse of its string representation (the reverse may be less than or greater than the original ...
20 votes
34 answers
2k views

Return all letter counts as an integer

Definition Given some string return an integer whose digits are the number ocurrences of a-z (case insensitive, in alphabetical order) in that string. Any character with 0 instances is skipped. ...
  • 337
11 votes
3 answers
286 views

Is it a valid line in "Girls & Boys"?

Intro Blur's song Girls & Boys featured the lines girls who are boys who like boys to be girls who do boys like they're girls, who do girls like they're boys ...
  • 2,055
16 votes
18 answers
950 views

AoCG2021 Day 11: Garbageful streams

Part of Advent of Code Golf 2021 event. See the linked meta post for details. Related to AoC2017 Day 9. Weekends are Bubbler's days off from posting these lol A large stream blocks your path. ...
  • 23.8k
-8 votes
12 answers
362 views

Joe Mama or Joe Biden [duplicate]

Your task Randomly pick and print "Joe Mama" or "Joe Biden" in as little bytes as possible. Rules No trailing lines, spaces, or anything else weird like that No election fraud! ...
  • 11
24 votes
29 answers
3k views

AoCG2021 Day 2: Naughty or nice?

Part of Advent of Code Golf 2021 event. See the linked meta post for details. The story continues from AoC2015 Day 5, Part 2. Santa needs help figuring out which strings in his text file are naughty ...
  • 66.3k
25 votes
36 answers
3k views

Randomly capitalize half of a string

Given string s of even length as input, randomly capitalize exactly half of the letters. You can assume the input will always be a non-zero, even length You can ...
  • 11.2k
30 votes
38 answers
3k views

Bubbler and 3 others are typing․․․

Task Implement a kind of "some users are typing" system, which can be found in Discord and some other chat clients. If 1 user (say, Bubbler) is typing, output ...
  • 66.3k
27 votes
24 answers
2k views

Convert prefix to infix

Infix notation is a method of printing mathematical expressions where each operator sits between its two arguments, such as \$ \left(5 \cdot 4\right) + 3 \$. Prefix notation is a method of printing ...
14 votes
9 answers
1k views

Convert Regex to Mask

From my CMC. Given a regex and a non-empty printable ASCII text, return one bit per character in the text, indicating the positions of beginnings of non-overlapping matches, and also the positions of ...
  • 28.5k
29 votes
31 answers
3k views

Open or Close the Parentheses

Every phone needs a calculator app. Because of the limited screen real estate, the developer of mine has decided to save some buttons. Instead of having two dedicated bracket buttons - one for open <...
  • 6,586
20 votes
15 answers
5k views

Write a Stack Exchange compliant brainfuck explainer

You are to take a string representing a piece of brainfuck code and Explanations, containing only printable ASCII characters and newlines ( to ...
  • 2,551
19 votes
21 answers
2k views

Alienese cycles

Alienese refers to two "languages" in the show Futurama. In actuality, they are two ciphers of English text with a pictographic alphabet. The first is a simple substitution cipher, but the ...
19 votes
19 answers
3k views

Make a Scrabble Word Finder

Yes, I know there is a similar question, but this one specifically concerns any possible words, even with letters left over, while the linked one restricts to a permutation of the input Objective ...
  • 3,835
6 votes
2 answers
728 views

Bigram frequencies in text

Introduction This challenge is about producing a code to count the frequency of bigrams in a text. A bigram is two consecutive letters in a text. For instance 'aabbcd' contains the bigrams aa, ab, bb, ...
19 votes
15 answers
2k views

Is it a prefix normal word?

Prefix normal words arise in the context of binary jumbled pattern matching. A binary word \$w\$ consisting of \$0\$s and \$1\$s is said to be prefix normal * if, among all of its substrings, none ...
  • 10.7k
23 votes
1 answer
613 views

(t)h(e)(i)(r)(m)

Sometimes authors will write (s)he as a stand in for she or he and for some reason they don'...
  • 90.5k
19 votes
12 answers
2k views

How many values of this type?

Background The number of values for a given type is called the cardinality of that type, and that of type T is written as |T|. Haskell and a few other languages ...
  • 66.3k
63 votes
49 answers
8k views

Increment The Time

Every digital clock contains a small creature that has to advance the time every minute [citation needed]. Due to the popularty of digital clocks and the popularity of catching them in the wild, they ...
  • 43.2k
24 votes
20 answers
3k views

Find the longest line

Given a string containing only the characters -, |, + and newline determine the longest ...
  • 90.5k
7 votes
8 answers
321 views

Encrypt this Message [duplicate]

Given a permutation of the alphabet and an input string, encrypt the input string by replacing all characters with the one's you've been given. The capitalization should be kept the same and non-...
  • 799
17 votes
17 answers
2k views

Longest Uncommon Substring

For the purposes of this challenge a substring \$B\$ of some string \$A\$ is string such that it can be obtained by removing some number of characters (possibly zero) from the front and back of \$A\$. ...
  • 90.5k
18 votes
22 answers
2k views

Parentheses Clusters

Write a program that groups a string into parentheses cluster. Each cluster should be balanced. Examples : ...
  • 329
-1 votes
1 answer
165 views

Find out your Ghost ghost name [duplicate]

Inspired by a tweet by Nathan W. Pyle There is, now, a standard method of converting your boring, normal human name into a mysterious, ethereal Ghost Name™️. Ably described by Mr Pyle... ...
  • 11.3k
6 votes
18 answers
858 views

Written Word Equation

Word equations, but not as you know it! Given a sentence which will include two numbers, numerically, and a spelt operator, in the order seen in the examples, your goal is to give the numerical answer ...
  • 1,682
10 votes
35 answers
3k views

English An or A?

Given a string consisting of only upper and lower case letters, output an if it begins with a vowel, and a if not. For the ...
  • 3,129
15 votes
8 answers
1k views

Simplify K projections

Background K functions have a feature called projection, which is essentially partial application of values to a function. The syntax for projections is a natural extension of the regular function ...
  • 66.3k
12 votes
9 answers
1k views

Implement a 2-tag system simulator

To quote http://brainfuck.org/utm.b: A tag-system transforms strings over an alphabet A = {a[1], a[2], ... a[n], a[n+1]} as follows: a positive integer ...
  • 1,483
16 votes
14 answers
2k views

When's the Listening Party?

A listening party is an event where a bunch of people get together to listen to some music (like a viewing party, but for music). In the age of the internet you can do Listening Parties online with ...
  • 90.5k
14 votes
3 answers
596 views

Snap (card game)

When I was a child I used to play a variation of Snap to stake soccer trading cards. "Game" is an overstatement because the only role of the players is to secretly prepare their starting ...
  • 2,153
10 votes
5 answers
437 views

The Most Palindromy Code to Calculate Palindromy Numbers

The string abaaba Is a palindrome, meaning it doesn't change when it's reversed. However we can split it in half to make two palindromes ...
  • 90.5k
21 votes
31 answers
2k views

Remove oddly nested substrings

Task: Input will consist of some text, with nested [] separating some of it into nested groups: ...
21 votes
28 answers
3k views

Find me vowels near you

Write a function that takes in a string and for each character, returns the distance to the nearest vowel in the string. If the character is a vowel itself, return 0. Vowels are : ...
11 votes
5 answers
424 views

Parse Ternary Lambda Calculus for correctness

Wheat Wizard has once tried to come up with a parsing problem unsuitable for regex, but it failed due to Anders Kaseorg's Perl regex answer. This is the second attempt. Now that we know that Perl ...
  • 66.3k
24 votes
5 answers
1k views

Parse a lambda for correctness

The goal of this challenge is to fill a niche that is mostly lacking on this site. In my observations there most parsing verification challenges fall into two categories: Super easy parsing. This ...
  • 90.5k
4 votes
2 answers
471 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

1 2
3
4 5
43