Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [string]

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

Filter by
Sorted by
Tagged with
13 votes
7 answers
526 views

Crack the Caesar cipher

The Caesar cipher is a simple and famous cipher, where the letters of the alphabet are rotated by some secret amount. For example, if our secret rotation is 3, we ...
user avatar
  • 6,655
12 votes
10 answers
808 views

From code to golf (Cops' thread)

This is a cops-and-robbers challenge, the robbers' thread is here You can change the word code into golf by changing a letter at ...
user avatar
  • 27.6k
17 votes
24 answers
1k views

Is this word in standard order?

Let \$ A \$ represent the alphabet, such that \$ A_1 = \$ a and \$ A_{26} = \$ z. Let's define that a word \$ W = w_1 w_2 ... ...
user avatar
  • 18.8k
17 votes
44 answers
2k views

Remove odd indices and double the even indices

Your task is simple, just remove the odd indices and double the even indices Example the input is Hello, World! and we get indices ...
user avatar
  • 2,493
13 votes
12 answers
1k views

Mat Printing Matrix

A manufacturing company wants to print a design on mats of varying dimensions, and they hired you to program a robot to make these mats. The design consists of alternating rings of any 2 symbols on a ...
user avatar
  • 3,051
15 votes
4 answers
321 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:...
user avatar
  • 27.6k
8 votes
4 answers
220 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 ...
user avatar
  • 85.1k
-3 votes
5 answers
176 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 ...
user avatar
  • 3,051
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 (...
user avatar
  • 27.6k
19 votes
8 answers
483 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 ...
user avatar
  • 85.1k
20 votes
42 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. ...
user avatar
  • 3,224
10 votes
8 answers
589 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 ...
user avatar
  • 2,823
19 votes
8 answers
444 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 ...
user avatar
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: ...
user avatar
  • 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 ...
user avatar
  • 2,493
20 votes
13 answers
626 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 ...
user avatar
  • 166k
10 votes
11 answers
360 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, ...
user avatar
  • 21k
25 votes
7 answers
777 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 ...
user avatar
  • 10.9k
8 votes
14 answers
699 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 ...
user avatar
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. ...
user avatar
11 votes
3 answers
283 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 ...
user avatar
  • 2,035
13 votes
16 answers
889 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. ...
user avatar
  • 21k
-8 votes
12 answers
351 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! ...
user avatar
  • 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 ...
user avatar
  • 62.2k
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 ...
user avatar
  • 11.1k
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 ...
user avatar
  • 62.2k
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 ...
user avatar
  • 27.6k
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 ...
user avatar
  • 27.2k
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 <...
user avatar
  • 6,240
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 ...
user avatar
  • 2,493
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 ...
user avatar
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 ...
user avatar
  • 2,597
6 votes
2 answers
647 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, ...
user avatar
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 ...
user avatar
  • 10.3k
23 votes
1 answer
610 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'...
user avatar
  • 85.1k
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 ...
user avatar
  • 62.2k
59 votes
47 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 ...
user avatar
  • 43k
24 votes
20 answers
3k views

Find the longest line

Given a string containing only the characters -, |, + and newline determine the longest ...
user avatar
  • 85.1k
7 votes
8 answers
319 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-...
user avatar
  • 789
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\$. ...
user avatar
  • 85.1k
18 votes
22 answers
2k views

Parentheses Clusters

Write a program that groups a string into parentheses cluster. Each cluster should be balanced. Examples : ...
user avatar
  • 329
-1 votes
1 answer
162 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... ...
user avatar
  • 11.1k
6 votes
16 answers
811 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 ...
user avatar
  • 1,682
8 votes
33 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 ...
user avatar
  • 3,053
15 votes
8 answers
988 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 ...
user avatar
  • 62.2k
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 ...
user avatar
  • 1,021
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 ...
user avatar
  • 85.1k
14 votes
3 answers
582 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 ...
user avatar
  • 1,973
10 votes
5 answers
428 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 ...
user avatar
  • 85.1k

1
2
3 4 5
42