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
15 votes
25 answers
1k views

Reverse hex cipher

Characters in strings are sometimes represented as their ASCII hexadecimal codes. Printable characters have two hex digits in their representation. Swapping those digits leads to another character, ...
user avatar
  • 10.9k
32 votes
32 answers
4k views

Eh, codegolf shmodegolf

This challenge is about implementing Shm-reduplication, originating in Yiddish, where one takes a word, duplicates it, and replaces the first syllable in the second word with "Shm" in order ...
user avatar
  • 601
13 votes
12 answers
2k views

I want 8 bits for every character!

This is the reverse of this challenge. Given an encoded list of codepoints and the characters used to encode it, you need to decompress it to its original string. For example, given the encoded list <...
user avatar
  • 4,206
12 votes
15 answers
5k views

LOOOOONG TEEEEEXT

Definition of long text Long text usually shows emphasis, for instance, loooooool or yaaaaaaaaaay. Usually the vowel is ...
user avatar
  • 529
12 votes
9 answers
332 views

Convert Alpha-2 to Alpha-3

The Task The task is easy: given an Alpha-2 country code, output the Alpha-3 equivalent. The input may be in any case you choose, and the output in any consistent case of your choosing. Here are the ...
user avatar
  • 2,537
27 votes
5 answers
3k views

Haplololololololology!

Haplology Haplology is a linguistic term: the omission of one occurrence of a sound or syllable that is repeated within a word, for example probly for probably. For this challenge, it means ...
user avatar
20 votes
8 answers
2k views

ASCII-Art n'th Root

Challenge: Given two integers \$a\$ and \$b\$, with lengths \$A=length(a), B=length(b)\$, output an ASCII-art of the \$a^{th}\$ root of \$b\$, including the answer rounded to \$A\$ amount of decimal ...
user avatar
26 votes
28 answers
2k views

Derivative of a product

In calculus, the derivative of a mathematical function defines the rate at which it changes. The derivative of a function f(x) can be marked as ...
user avatar
  • 27.6k
21 votes
16 answers
4k views

Who needs 8 bits for one character?

Given a string and the characters used to encode it, you need to compress the string by only using as many bits as each character needs. You will return the character codes for each character needed ...
user avatar
  • 4,206
11 votes
7 answers
638 views

Shortest restricted superstring

Given two sets of strings, \$ D \$ and \$ R \$, find the shortest string which contains every string in \$ D \$, but contains none of the strings in \$ R \$. There are almost always multiple possible ...
user avatar
  • 18.7k
19 votes
8 answers
2k views

Convert Alpha-3 to Alpha-2

I've been developing some programs involving me fetching a vector from a url using Alpha-2 country codes (such as GET /jp.svg for Japan). Except, oh no! All the ...
user avatar
  • 441
14 votes
22 answers
2k views

Shift a string gradually

Given an input string and a wrapping string, find the location of the first input string char in the wrapping string and replace it with the wrapping string char 1 step to the right of that, find the ...
user avatar
  • 3,053
9 votes
5 answers
874 views

Spell out an integer... in NDos' way

Objective Given a positive integer, spell it out in the conlang I made. Specification Let \$n\$ be the inputted integer. \$n\$ shall be spelled out in the following specification. The entire spelling ...
user avatar
  • 4,163
16 votes
23 answers
2k views

Pair my brackets

Given a string consisting of ()[]{}, print the paired brackets in the same order as they appear in the string. Any opening bracket ...
user avatar
  • 3,605
12 votes
18 answers
1k views

Words with Easy Letters in a Word Search

Introduction: Apparently I keep coming up with word search related challenges lately. :) When I do the word search in the Dutch news paper, some words are very easy to find because they contain ...
user avatar
9 votes
5 answers
300 views

Convert the type modifiers from prefix to C-fix

Given a base type T, this can be augmented with * or [], each meaning pointer and array. For ...
user avatar
  • 2,121
19 votes
8 answers
2k views

Optimally break a string into words

Given a string, like potatocarrot, break it into the smallest number of substrings possible. These substrings can consist either be a single character, or one of a ...
user avatar
14 votes
8 answers
733 views

Organize a Kiowa library

We are probably all used to the English alphabetical order: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z When we compare words in English for the sake of ...
user avatar
  • 85k
17 votes
17 answers
1k views

Play Caesar's Cipher with Letters only

Description The Caesar cipher is a cipher, where every letter in the alphabet will be rotated by a secret number. If the rotation is \$7\$, then a -> ...
user avatar
  • 3,605
11 votes
19 answers
3k views

What's the Missing Code? (Robbers)

Robbers' Challenge Read the cops' challenge first. In this cops-and-robbers challenge, you (the robbers) must find the correct string of characters, which, when added into the cop's code, will make it ...
user avatar
  • 837
26 votes
28 answers
3k views

What's the Missing Code? (Cops)

Cops' Challenge Robbers' challenge here. It has now been four days since the challenge was posted so all new answers should be marked as non-competing in the title. These answers can still be cracked ...
user avatar
  • 837
13 votes
9 answers
924 views

Remove unmatched brackets

Inspired by @AviFS. Given a string containing brackets, e.g. [xyz]]abc[[def]hij[ You can parse through it with a stack of brackets. When you find an open bracket, ...
user avatar
  • 27.6k
10 votes
8 answers
2k views

How many times do I break my own rule?

Introduction: In my recent Strikethrough the Word Search List challenge I mentioned the following: When I do the word-search puzzles, I (almost) always go over the words in order, and strike them ...
user avatar
6 votes
15 answers
899 views

Spaceship shooter

Your task is to output a spaceship of size n with shooters/guns and n bullets of character - ...
user avatar
  • 3,041
11 votes
14 answers
871 views

Arrange a Haft-Sin table

It's Nowruz and you want to set up a Haft-Sin table by words. This means finding seven words that start with letter s. The Challenge Write a program which its input is a list of words separated by ...
user avatar
13 votes
14 answers
2k views

Sandbox overflow

Your task is to output a square sandbox of size n+2 with / characters in the corners and | ...
user avatar
  • 3,041
10 votes
6 answers
415 views

The Missing Match

You are given a string of unknown length that contains a varied amount of (, {, [ and their ...
user avatar
  • 421
22 votes
32 answers
5k views

Negative of an ASCII photo

Task Given an \$m\times n\$ binary ascii "photo", return the negative of the photo Example: ...
user avatar
  • 1,011
12 votes
26 answers
1k views

Circular chained compound

Task Given a positive integer n, output the joined compound of circles The circles are of square of size n+2 but removing the ...
user avatar
  • 3,041
3 votes
9 answers
1k views

int, float or neither?

Given a string, determine if it is an int, a float or neither. Examples 123 - int 62727.0033 - float 644c.33 - neither Your code should output a different value depending on which it is. For example ...
user avatar
  • 179
25 votes
13 answers
860 views

Resolve references in a chat discussion

Sometimes in chat, if someone says something you agree with, you'll send a message with an ^, which points at the message above: ...
user avatar
2 votes
5 answers
142 views

Generate this string table [duplicate]

For the given string s, generate generate a table like below. ...
user avatar
  • 1,575
14 votes
16 answers
1k views

Building spikes

Inspired by this building (United States Air Force Academy Cadet Chapel, Colorado) Your task is simple, given a positive integer n, output the spiked building to ...
user avatar
  • 3,041
12 votes
7 answers
656 views

S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ the Word Search List

Introduction: Every workday I read the newspaper in the morning while eating breakfast, and also do some of the puzzles at the back. When I do the word-search puzzles, I (almost) always go over the ...
user avatar
15 votes
3 answers
340 views

What was my Wordle play?

Task Given a winning Wordle play results (clues), the target ("secret") word and a list of words, output a possible sequence of words leading to such results. The words in the list will be ...
user avatar
  • 10.9k
12 votes
20 answers
1k views

Convert a string of ASCII characters to base-3 equivalents

Task similar to this one. Take a string of ASCII characters and convert it to base-3 equivalents separated by a space. For example: Hello, world! Should be ...
user avatar
  • 1,575
21 votes
10 answers
1k views

Pretty print my arrays

I like to pretty print multidimensional arrays, like this: [ [ [1, 2, 3], [4, 5, 6] ], [ [7, 8, 9], [6, 4, 2] ] ] But it's a pain to do by hand and it'd ...
user avatar
  • 27.6k
12 votes
7 answers
699 views

Knights Jam | Chess

The knight is a chess piece that, when placed on the o-marked square, can move to any of the x-marked squares (as long as they ...
user avatar
  • 3,041
12 votes
5 answers
888 views

Simulating Bombs

More advanced version of this The aim of this puzzle is to simulate the impact of the shock wave of bombs on a square grid. The grid initially contains cells labelled ...
user avatar
  • 3,041
16 votes
17 answers
1k views

Capture the longest leading whitespace substring from lines

The Challenge Given a multiline string, return the longest substring of leading whitespace present in every line, ignoring empty lines or lines composed only of whitespace. If input is empty or ...
user avatar
12 votes
8 answers
801 views

Spinning Word Search

Introduction: Pete likes doing word search puzzles. Despite that, he has trouble searching for words vertically, (anti-)diagonally, or reversed. Because of that, he'll always search for the words left-...
user avatar
5 votes
6 answers
2k views

Real-world progress bar

Backstory, skip if you like Generating high quality pseudo random numbers is a tricky business but the fine engineers at < enter company you love to hate > have mastered it. Their progress bars ...
user avatar
  • 5,830
16 votes
18 answers
1k views

Triangle Tripler

Simpler version of this Task You must create a program that outputs a triangle of a given size N. A triangle is made of 3 identical triangles A triangle of size N should be made of N lines A triangle'...
user avatar
  • 3,041
19 votes
7 answers
2k views

Find my Māori pronouns

The Māori language has quite simple pronouns. It uses a single word for he/she/they/etc (ia), and the words for "you" and "me" are ...
user avatar
  • 27.6k
22 votes
7 answers
847 views

Happy new year string builder

This question is inspired by this awesome answer. The challenge is to write a program or function which takes in a positive integer, and outputs "Happy new year to you" or a slight variation ...
user avatar
  • 2,659
7 votes
9 answers
2k views

Write a spam-detection program

You work for a social media platform, and are told to create a program in a language of your choice that will automatically flag certain post titles as "spam". Your program must take the ...
user avatar
17 votes
6 answers
877 views

Retaining Water

Your task is to check the volume of water in a pool. Your have to create a program that takes in a input that is represented by an 10 by 10 grid of integers, with ...
user avatar
  • 3,041
22 votes
16 answers
1k views

Find the index of the matching parentheses for each character

The challenge is simple, find the matching parentheses for every one of the parentheses in a given string input E.g. ()()() -> [1, 0, 3, 2, 5, 4] Always start ...
user avatar
  • 3,041
42 votes
17 answers
6k views

Highlight a Wordle guess

In Wordle, you try to guess a secret word, and some letters in your guess are highlighted to give you hints. If you guess a letter which matches the letter in the same position in the secret word, the ...
user avatar
  • 18.7k
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,645

1
2 3 4 5
42