Skip to main content

Questions tagged [string]

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

Filter by
Sorted by
Tagged with
6 votes
2 answers
267 views

Snake a string through a simplex

An n-simplex is a generalization of 'triangleness' in any dimension (specifically, it is the simplest shape requiring n dimensions). Starting with 0 dimensions, the named simplexes are: point, line ...
guest4308's user avatar
  • 1,215
-1 votes
1 answer
58 views

Function to Convert string to Hexadecimal [duplicate]

Assignment: Create a function that can convert a string to its encoded hexadecimal value. In your answer, also show how to run this function (to validate answers). Your function must return OR print ...
Jake's user avatar
  • 9
7 votes
8 answers
535 views

Curry a C function pointer [closed]

Objective Given a type signature of a C function pointer represented as a string, output the (fully) curried version of it, also as a string. I/O format It is assumed that: There is at least one ...
Dannyu NDos's user avatar
  • 6,299
14 votes
16 answers
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 ...
Dannyu NDos's user avatar
  • 6,299
3 votes
1 answer
194 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 & ...
Kamila Szewczyk's user avatar
23 votes
20 answers
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 ...
z..'s user avatar
  • 1,211
9 votes
12 answers
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 ...
SanguineL's user avatar
  • 738
27 votes
41 answers
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 ...
noodle person's user avatar
1 vote
2 answers
245 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 ...
Dhanush's user avatar
  • 21
-1 votes
3 answers
482 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-...
user avatar
19 votes
22 answers
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 ...
Mark's user avatar
  • 299
7 votes
7 answers
600 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 (...
Nicola Sap's user avatar
  • 3,694
20 votes
30 answers
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 ...
Arunabh's user avatar
  • 311
14 votes
8 answers
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 ...
3-1-4-One-Five's user avatar
9 votes
14 answers
830 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 ...
None1's user avatar
  • 1,125
21 votes
14 answers
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' ...
Kevin Cruijssen's user avatar
14 votes
5 answers
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)....
Nicola Sap's user avatar
  • 3,694
13 votes
13 answers
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 ...
Erel Segal-Halevi's user avatar
11 votes
22 answers
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. ...
None1's user avatar
  • 1,125
0 votes
1 answer
299 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 ...
LargeHorse's user avatar
12 votes
3 answers
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 ...
tsh's user avatar
  • 35k
6 votes
10 answers
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 ...
guest4308's user avatar
  • 1,215
14 votes
10 answers
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 ...
emanresu A's user avatar
  • 41.6k
-3 votes
5 answers
252 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
664 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
806 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
774 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
35 votes
17 answers
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: ...
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
  • 401
24 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
  • 10.4k
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,103
2 votes
2 answers
824 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
381 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
1 vote
1 answer
363 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,219
7 votes
4 answers
403 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
  • 99.5k
16 votes
20 answers
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 ...
Sny's user avatar
  • 439
5 votes
6 answers
520 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,103
4 votes
7 answers
458 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
  • 41.6k
7 votes
12 answers
960 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
  • 26k
7 votes
11 answers
795 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,630
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
  • 35k
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,620
16 votes
2 answers
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: あかさ たなは まやら 小わ、 ...
bigyihsuan's user avatar
  • 10.4k
11 votes
8 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,660
11 votes
20 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,620
16 votes
8 answers
967 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,660

1
2 3 4 5
45