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
1 vote
3 answers
153 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
0 votes
3 answers
383 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
18 votes
21 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
  • 289
7 votes
7 answers
552 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,685
20 votes
29 answers
1k 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
789 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,065
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,685
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,065
0 votes
1 answer
263 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
  • 34.9k
6 votes
10 answers
970 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
  • 643
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
  • 38.8k
-3 votes
5 answers
237 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
605 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
752 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
750 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
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,766
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,093
2 votes
2 answers
811 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
330 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
306 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,193
7 votes
4 answers
389 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.8k
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
510 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,093
4 votes
7 answers
426 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
  • 38.8k
7 votes
12 answers
955 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
  • 24.5k
7 votes
11 answers
779 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,470
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.9k
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,610
16 votes
2 answers
288 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,766
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,580
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,610
16 votes
8 answers
959 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,580
19 votes
24 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,580
7 votes
1 answer
295 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
35 votes
38 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
686 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
18 votes
21 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
804 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,580
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.8k
13 votes
4 answers
531 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

1
2 3 4 5
45