Questions tagged [string]

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

Filter by
Sorted by
Tagged with
-3 votes
5 answers
202 views

Create the characters you can write on a MacOS US English Keyboard (as another OS will read them)

Introduction This is a small challenge I came up with while trying to make some compact code for my younger brother to use. I don't think it's particularly interesting, but I believe it presents some ...
Mel's user avatar
  • 9
4 votes
5 answers
563 views

Remove filler words from a string

I always stutter and use filler words when speaking to a lot of people at a time. So I need something to remove all my filler words. So here is the challenge. Your program should take input as a ...
3-1-4-One-Five's user avatar
11 votes
12 answers
731 views

Rockstar Poetic Number Literals!

The Rockstar programming language has "poetic number literals", allowing you to assign nonnegative, finite (at least one Rockstar interpreter supports infinity) numbers to variables without ...
3-1-4-One-Five's user avatar
11 votes
22 answers
1k views

Map key with value as standard [closed]

Given a non-empty string containing only printable ASCII (codepoints 0x20 to 0x7E), write the shortest program or function that map the key to its value. Inside the string the key will always have a ...
G. Ciardini's user avatar
10 votes
14 answers
739 views

Swifty Argument Labels

For the purpose of this challenge, arguments are things you pass to a function at the call site, while parameters are what the function uses in its implementation. Or, more succinctly: arguments = ...
macOSisthebestOS's user avatar
34 votes
17 answers
3k views

Create a cactus from words

Introduction: A typical cartoonish cactus usually looks like this: One big stem in the middle, with some L-shaped branches sticking out. We'll use this general shape for this challenge. Challenge: ...
Kevin Cruijssen's user avatar
8 votes
12 answers
1k views

Scan input for numbers and add thousands separators

Challenge Given ASCII-encoded text input of any size, detect numbers between -1,000,000,000,000,000,000 and 1,000,000,000,000,000,000 exclusive and rewrite them with thousands separators. Use commas ...
noname's user avatar
  • 391
23 votes
41 answers
2k views

Swap letter cases

Given a non‑empty string containing only printable ASCII (codepoints 0x20 to 0x7E), write the shortest program or function that swaps the cases of A-Z and ...
bigyihsuan's user avatar
  • 9,348
18 votes
25 answers
3k views

Strings without twin letters

Consider an arbitrary set of letters \$L\$. It may either be \$\{A, B, C\}\$, \$\{M, N, O, P\}\$, \$\{N, F, K, D\}\$, or even contain all the 26 letters. Given an instance of \$L\$ and a positive ...
enzo's user avatar
  • 2,083
2 votes
2 answers
791 views

Compiler for LaTeX

Problem: Given a string representing a mathematical expression with constants (pi, e, psi, i), basic arithmetic operations (+, -, *, /), parentheses, fractions, and exponentiation, write a program or ...
3.14's user avatar
  • 383
-9 votes
1 answer
286 views

Print Goodbye World instead of Hello World

Make a cat program, with a catch. The program must refuse under all circumstances to output "Hello World", instead outputting "Goodbye World", with matching spacing (but matching ...
Devsman's user avatar
  • 173
0 votes
0 answers
302 views

How quickly can you type this string?

Given a string consisting of only printable ascii (letters, numbers, symbols, and spaces), how many keystrokes are required minimally to type out this string from scratch? That is, current text is ...
Larry Bagel's user avatar
  • 4,173
7 votes
4 answers
384 views

Busy Letters & Evil CEOs

Imagine you are given an array/string containing \$5\$ letters of the English alphabet, with each letter having any value from A to Z (inclusive). Every day, each letter will perform a job, which can ...
Trivaxy's user avatar
  • 487
16 votes
10 answers
1k views

Find the finest building blocks

Given a string \$X\$ we will say two strings, \$a\$ and \$b\$, are building blocks of \$X\$ if \$X\$ can be made by concatenating some \$n\$ \$a\$s with \$m\$ \$b\$s in any order. For example the ...
Wheat Wizard's user avatar
  • 98.5k
15 votes
19 answers
2k views

Doubleouble Talkalk

Input A non-empty string or list of capital letters k with length between 3 to 5000. Output A value indicating whether k can be ...
Sunny Lu's user avatar
  • 419
5 votes
6 answers
491 views

Aircraft registration numbers

Write a program that takes a United States aircraft registration number and returns a 24-bit ICAO hex code corresponding to that registration and vice-versa. An aircraft registration number always ...
Chris's user avatar
  • 2,009
8 votes
8 answers
1k views

Find the child anagrams of a word

Select any word from https://websites.umich.edu/~jlawler/wordlist with length greater than 1. For each letter on that word, remove it and check if any rearrangement of the remaining letters is present ...
enzo's user avatar
  • 2,083
4 votes
7 answers
411 views

Heart plus diamond is spade-and-club: table puzzle

I found this YouTube video with a table on it showing some card suits with ampersands. You might not understand what it is about, but I still want to make a challenge about it. The input is two suits, ...
3-1-4-One-Five's user avatar
23 votes
12 answers
6k views

How long is this string, really?

In most programming languages, the string Hello, World! can be represented as "Hello, World!". But if you want to ...
emanresu A's user avatar
  • 37.8k
7 votes
12 answers
954 views

Can their first appearance happen together?

Given two non-empty 01 strings, check if there is string containing both given strings, and their first appearance end at same position. Test cases: ...
l4m2's user avatar
  • 23.9k
7 votes
11 answers
772 views

Convert tiers between credit rating system

Related: Sort these bond ratings Credit rating agencies assign ratings to bonds according to the credit-worthiness of the issuer. The rating business is mostly controlled by "Big Three" ...
matteo_c's user avatar
  • 6,310
12 votes
10 answers
1k views

Format Datetime in 30-Hour Clock Time

Input a datetime, format the datetime in YYYY-MM-DD HH:mm:ss format using 30-hour clock time. The 30-hour clock time works as: After 6 a.m., it is same as 24-hour ...
tsh's user avatar
  • 34.7k
21 votes
18 answers
6k views

Am I vaccinated?

Disclaimer: the content of this post is not medical information and should not be used for any medical purpose, as it is deliberately oversimplified for the purpose of the challenge. There are several ...
Someone's user avatar
  • 1,580
16 votes
2 answers
280 views

Translate Japanese hiragana into the flick input method

The flick input method is a way of inputting Japanese kana on a modern smartphone. It is arranged in a 12-key layout, with the following labels: あかさ たなは まやら 小わ、 ...
bigyihsuan's user avatar
  • 9,348
10 votes
7 answers
1k views

Night hike partitioning

We want to go on a night hike with the youth group, but of course not everyone has their torch, even though we told them we planned to split up. What options are there for group formation if n teens ...
Philippos's user avatar
  • 2,501
10 votes
18 answers
3k views

Can the chefs go?

On the TV cooking show Guy's Grocery Games, the chefs cannot begin shopping until Guy Fieri, the show's host, says "Three, two, one, go!" However, the words do not have to be all together. ...
Someone's user avatar
  • 1,580
16 votes
8 answers
958 views

One-dimensional map colouring

It is a well-known fact that you can colour a two-dimensional map with four colours in such a way that two countries with a common border always have different colours. There have already been enough ...
Philippos's user avatar
  • 2,501
16 votes
21 answers
2k views

Just another traffic jam!

One lane is closed, the vehicles have to thread their way in according to the zip-lock system: One car from one lane, the next car from the other lane, always taking turns. Input: Two vehicle queues, ...
Philippos's user avatar
  • 2,501
7 votes
1 answer
285 views

Literate Programming in Base 26

Your task is to convert non-empty strings - between strings using the 26 letters, and programs, which are strings of bytes, where each byte has 256 possible values. You should use the same codepage ...
Command Master's user avatar
32 votes
36 answers
6k views

aaabbabbc⠀⠀⠀⠀⠀⠀

One element of the list aa, ab, ba, bb, c has been removed, and the remainder shuffled and joined with no separator. Find the missing element. For example, if the ...
Sisyphus's user avatar
  • 14.8k
9 votes
8 answers
672 views

Produce the shortest suffix for an (almost) arbitrary string

I encountered some silly code from a game and I figured this would actually turn into a fun golfing problem, so: Given any ASCII string in the limited char range specified below. Append as few ...
Olipro's user avatar
  • 199
16 votes
19 answers
2k views

Last Week Day Of The Month

Introduction This challenge was inspired by a seemingly simple task requested at work that couldn't easily be done in Microsoft Teams. At least not from what we could find! Task Your task, if you ...
Mark Harwood's user avatar
11 votes
6 answers
803 views

Find the conflict-free sitting arrangement

Party time! All of your guests are sitting around a round table, but they have very particular seating requirements. Let's write a program to organize them automatically! Guests are represented by ...
Philippos's user avatar
  • 2,501
9 votes
8 answers
1k views

Is it a valid hidden word?

The Universal Crossword has a set of guidelines for crossword puzzle submissions. In this challenge we are going to be concerned with their rules for hidden word themes. A hidden word clue consists ...
Wheat Wizard's user avatar
  • 98.5k
13 votes
4 answers
526 views

Golf a LaTeΧ math expression

A problem I sometimes encounter is that when writing comments using LaTeX, the comment is too long. Today you will solve this, by writing code which, given a LaTeX math expression, will produce the ...
Command Master's user avatar
16 votes
14 answers
1k views

Implement the RegPack decompressor

The JavaScript compressor RegPack uses a very simple string compression algorithm. Given a piece of code, it will make a list of characters that aren't used in that code and use them to delimit ...
emanresu A's user avatar
  • 37.8k
8 votes
10 answers
2k views

Decrypt an Autokey Cipher

The autokey cipher is closely related to the Vigenère cipher (both were invented by Blaise de Vigenère). Decryption involves the encrypted message and the key. For simplicity, let us assume all ...
SquareFinder's user avatar
9 votes
12 answers
3k views

Funny Numbers :D

The task is to calculate the average "funniness" of a given number given the following scoring system: 1 point for each "420" in it 2 points for each "69" in it 3 points ...
Joseph's user avatar
  • 115
23 votes
10 answers
2k views

I (rev)?(pal)? the source code, you (rev)?(pal)? the input!

Just because the reverse and palindrome were not too challenging individually :) Write a program (full program or function) that satisfies the following: given a string input, the program as-is ...
Bubbler's user avatar
  • 76k
29 votes
10 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
  • 59.2k
8 votes
9 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
  • 6,893
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
  • 6,893
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
  • 383
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
20 votes
18 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
  • 6,015
17 votes
13 answers
2k 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
  • 98.5k
29 votes
17 answers
4k views

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

This ascii-art 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
  • 6,893
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
18 votes
24 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
  • 2,085
9 votes
17 answers
982 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

1
2 3 4 5
44