# Questions tagged [string]

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

2,218 questions
Filter by
Sorted by
Tagged with
2k views

### Reduce a string up to idempotency [closed]

Objective Given a string consisting of printable ASCII characters (!0x21 ― ~0x7E), treat it as an element in the free idempotent ...
• 6,221
181 views

### How comparison-heavy is this list? [closed]

Given a list of strings in any convenient format display the amount of comparisons between individual characters that a merge sort algorithm would perform. The merge-sort algorithm is a divide & ...
• 12.5k
2k views

### Simulate Text Cursor

You are given a string [A-Za-z|]+ that contains exactly one occurrence of | denoting the current position of the cursor and a ...
• 1,171
3k views

### Keyboard Ping Pong

Keyboard Ping Pong (This question was inspired by this post.) Challenge Given a string of letters, determine if the word "ping-pongs" across the keyboard. (Letters alternating between sides ...
• 738
2k views

### Segments of a string, doubling in length

Simple task today. Given a string whose length is one less than a whole power of 2, divide it into segments with doubling length. For example for the string ...
• 8,910
1 vote
244 views

### Write a function that takes an input string and encodes it using a modified Fibonacci sequence in reverse [closed]

Given an input string, first convert each character to its ASCII value. Generate a reversed Fibonacci sequence of the same length as the input string. Encode each character by adding its ASCII value ...
• 21
480 views

### Sum of Positive and Negative Powers of 2

Given a binary string equivalent to $n$, write out the least possible number of terms needed to express $n$. A term is defined as an addition of either $2^k$ or $(-2^k)$, where $k$ is a non-...
1k views

### Find characters common among all strings

Find characters common among all strings You are given multiple Strings as an input. Your task is to find the characters that are present in every string, and ...
• 299
596 views

### Build the first 6 letters of an Italian codice fiscale (tax identification number)

Given a single string with a person's name and surname, output the first 6 characters of their codice fiscale. Codice fiscale Codice fiscale is a 16-character long alphanumeric string that identifies (...
• 3,694
2k views

### Break a word into vowels and consonants

Objective Given an string $n$, output two strings, namely the string consisting of vowels "a", "e", "i", "o", and "u", and the string consisting of ...
• 311
1k views

### Compare two strings, with NaC

I just thought of this idea: if we have NaN ("not a number") for floats, how about NaC ("not a character") for a single unknown character in a string? Your input should be two ...
• 1,421
826 views

### Convert CSV tables to MediaWiki tables

Input a CSV table, like this: data00,data01,data02,...,data0m data10,data11,data12,...,data1m ... datan0,datan1,datan2,...,datanm The cells in the CSV table is ...
• 1,115
3k views

### Cold Bee and Old Beer

Introduction: Inspired by this silly meme video, which states 'COLD BEER', but is slightly too large for the scrolling advertisement board, causing it to display either 'COLD BEE' or 'OLD BEER' ...
• 129k
1k views

### Decode a Caesar ciphertext with high probability

Caesar ciphers A Caesar cipher with shift=N is the process of replacing any alphabetic character in a string with the letter which is N positions ahead in the alphabet (wrapping back at the beginning)....
• 3,694
2k views

### Compute the degree of a string

The input is a string made of the letters a,b,c only. The output is an integer representing the degree of the sequence. The degree of a sequence is computed as follows: Assume that each of the ...
• 1,993
2k views

### Decode Caesar cipher based on a given text

I can't think of a better name. This is similar to this challenge, but a lot easier. Read three strings which contain only uppercase letters. The length of the first and second strings are the same. ...
• 1,115
290 views

### How can I reduce the characters in the following python code? [closed]

The following code is 47 characters. print(("Ekki v","V")["COV"in input()]+"eikur!") How can it be reduced to 46 or less? I ...
1k views

### HTML Table Parser

Input a strict subset of HTML <table> string representation as defined below. Output parsed table, while any cells who span multiple rows or columns, record ...
• 35k
983 views

### Divisibility patterns

Your inputs are a string and an integer. Your output is the 2d matrix of strings achieved from adding 0 to N spaces between each ...
• 1,073
1k views

### Enumerate all matches of a regex

related For this challenge, we'll be using a simplified dialect of regular expressions, where: A lowercase letter from a to z ...
• 39.9k
249 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 ...
• 9
647 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 ...
• 1,421
777 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 ...
• 1,421
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 ...
• 277
763 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 = ...
4k 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: ...
• 129k
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 ...
• 401
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 ...
• 10.4k
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 ...
• 2,093
823 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 ...
• 383
363 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 ...
• 173
1 vote
360 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 ...
• 4,211
401 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 ...
• 487
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 ...
• 99.4k
3k 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 ...
• 439
518 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 ...
• 2,009
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 ...
• 2,093
447 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, ...
• 1,421
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 ...
• 39.9k
959 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: ...
• 25.7k
791 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" ...
• 6,610
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 ...
• 35k
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 ...
• 1,620
315 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: あかさ たなは まやら 小わ、 ...
• 10.4k
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 ...
• 2,620
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. ...
• 1,620
964 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 ...
• 2,620
3k 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, ...
• 2,620
311 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 ...
• 10.6k