Questions tagged [string]

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

Filter by
Sorted by
Tagged with
28 votes
8 answers
3k views

What's my type? Well... Probably

There are a lot™ of pokemon. One of the defining characteristics of pokemon is their type, of which every1 pokemon has up to two types, a primary type and an optional secondary type. There are ...
DJMcMayhem's user avatar
  • 58.7k
7 votes
8 answers
1k views

Compile TailwindCSS to CSS

TailwindCSS is a utility that lets one write CSS code using only HTML classes, which are then converted to CSS code with the Tailwind compiler. Ordinarily, one would write CSS in a separate file from ...
noodle man's user avatar
  • 3,965
14 votes
10 answers
3k views

When in {country}, do as the {countrians} do

(or: Output the plural demonym.) When in Rome, do as the Romans do. This is a well-known English phrase meaning that it’s best to follow what others are doing around you — to go with the flow. Today, ...
noodle man's user avatar
  • 3,965
10 votes
12 answers
2k views

Encrypting Emojis

Problem You are tasked with creating a program that performs emoji encryption on a given string of emojis. In this encryption scheme, each emoji is replaced by a unique character (from ...
3.14's user avatar
  • 327
12 votes
18 answers
1k views

Print a meter of numbers to a specified limit

Given a positive integer n, output a number meter formatted like this: ...
TKDKid1000's user avatar
19 votes
17 answers
1k views

Compute the convolution of two strings

While implementing polynomial multiplication in Itr I found the following interesting operation on strings To compute the convolution of two strings (for instance ...
bsoelch's user avatar
  • 4,653
17 votes
13 answers
1k views

Efficient censorship

This challenge was originally posted on codidact. You are a low-level censor working for the Ministry of Media Accuracy. Part of your job is to make sure that certain words don't appear in ...
Wheat Wizard's user avatar
  • 95.5k
26 votes
17 answers
4k views

s-n-a-k-e-a-r-o-u-n-d--->

This code-golf challenge is about walking around a string like a snake. s-n-a-k .---. e d <-' a n-u-o-r You will be given a string \$ S \$ of length \$ l \$ and ...
noodle man's user avatar
  • 3,965
13 votes
15 answers
2k views

Can you perform swaps?

Today's problem is easy. You're given two strings A and B of equal length consisting of only the characters ( and ). Check ...
Huỳnh Trần Khanh's user avatar
17 votes
23 answers
3k views

Meta-cat program

Write a program or function that takes input and outputs/returns a full program (in the same language) that outputs said input. Note that the input may contain any printable ASCII character or newline ...
Dadsdy's user avatar
  • 1,995
9 votes
17 answers
955 views

Continuously Count Consecutive Cases

Background Imagine that I'm creating a really long necklace, consisting of only two characters, A and B. You must count the ...
Jacob Creutzfeldt's user avatar
7 votes
4 answers
272 views

Simulate Keyboard Inputs

Background You know how in text editors and just text fields in general, there's always that blinking bar where you type? Yeah, simulate typing there. You'll be given 3 inputs: The current text field, ...
Jacob Creutzfeldt's user avatar
11 votes
11 answers
1k views

(Robbers) Fast and Golfiest Season 1: The Lord of the Strings

Fast and Golfiest Robbers Thread Welcome to the first season of Fast and Golfiest, a cops-and-robbers challenge! I designed this challenge to encourage competitive coding for efficiency (fastest ...
Shiran Yuan's user avatar
17 votes
15 answers
1k views

(Cops) Fast and Golfiest Season 1: The Lord of the Strings

Fast and Golfiest Cops Thread Welcome to the first season of Fast and Golfiest, a cops-and-robbers challenge! I designed this challenge to encourage competitive coding for efficiency (fastest ...
Shiran Yuan's user avatar
13 votes
8 answers
684 views

Generate all linked chains

A followup to this challenge by Jeremy Collprav, inspired by DLosc solving this in Regenerate. Some sections copied from the linked challenge. Linking chains We define a chain to be a string ...
caird coinheringaahin g's user avatar
14 votes
15 answers
1k views

Two Parallel Linked Chains

Background We define the two types of chain to be a string that contains only dashes, "-", or only underscores, "_". We link two chains using one equals sign, "=". ...
Jacob Creutzfeldt's user avatar
10 votes
5 answers
846 views

Translate the keitai input method

The keitai input method is a method for writing Japanese kana on a 12-key phone keypad. Similar to Western keypads, each kana is assigned to a key; when the key is pressed multiple times, it cycles ...
bigyihsuan's user avatar
  • 8,248
1 vote
0 answers
106 views

Bunny Shakespeare poetry [closed]

Suppose you have a grid of cells that is 6 wide and arbitrarily tall. In each cell is a word. Let the bottom row, which is row #1, be the last 6 words of sample.txt in order. Let the second to last ...
mikebolt's user avatar
  • 121
1 vote
0 answers
121 views

making a binary string palindrome using xor operations [closed]

Problem You are given a binary string A of length N. You can perform the following type of operation on the string A: Choose two different indices \$i\$ and \$j\$ (\$1 \le i\$, \$j \le N\$) Change \$...
hemanth's user avatar
  • 11
18 votes
3 answers
2k views

Render text in a slanted ASCII-art font

Given a text input such as: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG render the following output: ...
Timwi's user avatar
  • 12.9k
19 votes
24 answers
2k views

Split a string on unnested commas

Create the shortest program/function/whatever that splits an inputted string along un-nested commas. A comma is considered nested if it is either within parentheses, brackets, or braces. Input and ...
Dadsdy's user avatar
  • 1,995
19 votes
26 answers
2k views

Find Unique Anagrams

Challenge Description: An anagram is a word or phrase formed by rearranging the letters of another word or phrase. For example, "listen" and "silent" are anagrams. In this ...
cold10's user avatar
  • 293
13 votes
11 answers
2k views

String Concatenate

You are given a string \$s\$ of characters from a to z. Your task is to count how many unique strings of length \$n\$ you can make by concatenating multiple prefixes of the string \$s\$ together. ...
Huỳnh Trần Khanh's user avatar
11 votes
10 answers
2k views

Parse a CSV file

In this challenge, given a CSV file as a string, you'll return the data contained as a 2d array of strings. Spec: The input consists of one or more records, delimited with ...
Borkbot's user avatar
  • 111
14 votes
20 answers
2k views

String Comparison

You are given two strings \$a\$ and \$b\$ consisting of characters from a to z in lowercase. Let \$n\$ be the length of \$a\$. Let \$m\$ be the length of \$b\$. Let \$a'\$ be the string \$a\$ repeated ...
Huỳnh Trần Khanh's user avatar
11 votes
7 answers
2k views

Zahlen auf Deutsch! (Numbers in German)

Your task is to write a program that receives a base 10 number from 0 to 99 and outputs the German name of that number with non-ASCII characters replaced with ASCII equivalents. German number names <...
Creative Name's user avatar
17 votes
10 answers
2k views

Shortest distinguishable slice

For this challenge, a slice of a string is defined as an upper and lower index that can "cut" a piece of a string. All characters from the string in the range ...
noodle man's user avatar
  • 3,965
9 votes
5 answers
729 views

On The Subject Of Simon Says

This challenge is from a game, Keep Talking And Nobody Explodes. This is like one of those toys you played with as a kid where you have to match the pattern that appears, except this one is a knockoff ...
Dannyu NDos's user avatar
  • 5,141
11 votes
41 answers
2k views

Counting Letters in a String

Write a program or function that takes in a string and outputs a count of each modern English alphabet letter in the string, case-insensitive. Input: A string consisting of printable ASCII characters (...
Aitzaz Imtiaz's user avatar
5 votes
25 answers
496 views

String with the smallest sum of ASCII values

Description In this challenge, you need to write a function that takes in a list of strings and returns the smallest string based on their ASCII value. You should assume that the input list contains ...
Aitzaz Imtiaz's user avatar
0 votes
5 answers
312 views

Mirror a String in Place

Write a program that takes a string as input and modifies it by reversing the string in its place by mirroring the position. The first position goes to last, second to second last and so it goes on. ...
Aitzaz Imtiaz's user avatar
10 votes
31 answers
2k views

The number of distinct words in a sentence

Challenge: Find the number of distinct words in a sentence Your task is to write a program that takes a sentence as input and returns the number of distinct words in it. For this challenge, words are ...
Aitzaz Imtiaz's user avatar
12 votes
15 answers
917 views

Sum of strings (UTF-16 codepoints)

Your function must accept two strings and return new string where are UTF-16 code of all symbols is the sum of UTF-16 codes of inputs symbols If the resulting sum is greater than ...
EzioMercer's user avatar
  • 1,473
13 votes
16 answers
1k views

Find opposite string

Your function must accept one string and return the opposite The opposite string is a string where all characters go in reverse order, all letters are replaced with the opposite mirror letter from the ...
EzioMercer's user avatar
  • 1,473
13 votes
9 answers
1k views

Translate to plorcly borglar

plorcly borglar is a "mod" created by jan Misali for the constructed language toki pona that makes words sound funny. It involves substituting the 14 toki pona letters for funnier versions ...
Wheat Wizard's user avatar
  • 95.5k
15 votes
10 answers
2k views

Human oriented string comparison

Traditionally when you compare two strings you use lexicographical comparison. That can be described by the recursive algorithm: $$ f(x, y)= \left\{\begin{array}[rr] \\ \mathrm{EQ} & \mathrm{if}\,\...
Wheat Wizard's user avatar
  • 95.5k
9 votes
15 answers
2k views

Sum of numbers of arbitrary length

Your function must accept 2 strings which are correct numbers. It needs to sum them up (without rounding and floating point errors) and return the result (which is also a correct number) without any ...
EzioMercer's user avatar
  • 1,473
14 votes
13 answers
2k views

Salacious Bacon Tripod

In a certain chatroom, we like making acronym jokes about the build tool we use called sbt. While it usually stands for "Scala Build Tool", we aim to come up with all sorts of meanings, such ...
lyxal's user avatar
  • 31.4k
10 votes
9 answers
861 views

Parse basic arithmetic into an AST

Introduction An abstract syntax tree (AST) is a tree of tokens that shows their connection to each other and syntactical meaning. They are commonly used in compilers and static analysis tools, as ...
Michael M.'s user avatar
10 votes
9 answers
794 views

Find the length of the longest substring with all different characters in O(n) time

Let's solve the same task as in this challenge but faster! Input: a non-empty string containing letters a-z Output: the length of a longest (contiguous) substring in which all letters are different ...
anatolyg's user avatar
  • 13.1k
14 votes
8 answers
1k views

Change the subject

Sometimes I feel like the conversation is going down the wrong path and take it upon myself to steer it in another direction. And this conversation is going wrong real fast, so I need to change the ...
noodle man's user avatar
  • 3,965
15 votes
20 answers
3k views

Guess the song title

I have this problem where I listen to so much music that I can never remember what songs are called. But even if I remember the lyrics, I won't always know the song's name. But lucky for me, there's a ...
noodle man's user avatar
  • 3,965
13 votes
17 answers
2k views

Remove duplicates from my academic transcript

Consider a list of subject, grade pairs. E.g. ...
Simd's user avatar
  • 1,343
16 votes
15 answers
1k views

Division between two strings

Inverse function of this challenge To (properly) multiply an string by an integer, you split the string into characters, repeat each character a number of times equal to the integer, and then stick ...
l4m2's user avatar
  • 19k
8 votes
9 answers
2k views

Wordle games without repeating letters

Given a word list, find all sets of five words of five letters each, such that the words of each set have 25 distinct letters in total. This challenge was inspired by this video by Matt Parker. ...
matteo_c's user avatar
  • 5,593
19 votes
16 answers
2k views

Is it true? Ask Pip!

Title is an homage to this classic challenge In Pip, the Scalar data type encompasses strings and numbers. A Scalar value is truthy in most cases. It is falsey only if: It is the empty string ...
DLosc's user avatar
  • 37.7k
15 votes
7 answers
769 views

Parse WebSocket frames

According to MDN, every WebSocket message is sent as one or more frames. Your job is to extract the payload given a (masked) client-to-server text frame. The steps to extract the payload is as follows:...
sheared's user avatar
  • 151
15 votes
5 answers
430 views

Flip the order of operations

Scientists have made contact with a parallel universe. Just one problem: They write math differently. Help the scientists make a program that can convert normal math expressions to their equivalent in ...
mousetail's user avatar
  • 11.4k
8 votes
32 answers
1k views

Keep elements in sequence that have a letter repeated at least 3 times

Challenge: Given the input array l with a list of strings, only keep the elements in the sequence that have a letter that's repeated at least 3 times. Like ...
U13-Forward's user avatar
  • 1,981
28 votes
45 answers
2k views

Replace 0s In a String With Their Consecutive Counts

Challenge Given a string of any length which contains only digits from 0 to 9, replace each consecutive run of the digit ...
user avatar

1
2 3 4 5
44