Questions tagged [string]

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

Filter by
Sorted by
Tagged with
4 votes
3 answers
134 views

Repeating terms of a given sentence [closed]

Program Write a program to display repeating terms of a given sentence. Explanation The program must output the repeating terms of two or more letters from the given input (input is a sentence ...
  • 243
13 votes
11 answers
1k views

Variable length Fibonacci word

Challenge For any two non-empty strings A and B, we define the following sequence : F(0) = A F(1) = B F(n) = F(n-1) + F(n-2) Where ...
11 votes
5 answers
521 views

Outsmart the boffins at New Scientist (string rotation)

The brainiacs at New Scientist tweeted this morning that "The word STABLE has the neat property that you can cycle the first letter to the end to make a new word: TABLES. And you can do it again ...
23 votes
26 answers
2k views

Overwrite a string on a tape

Take the string abcdfghjk. To overwrite it, starting from f, with the string wxyz, you would ...
19 votes
3 answers
2k views

Calculate longest Stack Exchange streak

Introduction This challenge is inspired by the Meta Stack Exchange question The longest consecutive days streak; it turns out that the URL ...
-2 votes
5 answers
188 views

Pretty printing JSON

I want format a JSON string into human-readable form. A string like this: ...
7 votes
5 answers
233 views

(Σ*)² ⟲ Σ* (Round-Trip a String Pair)

We're back! And this time with an objective scoring criteria! This is a challenge I thought of recently which I think is not hard but allows for a wide range of possible solutions. Seems like a ...
  • 709
14 votes
2 answers
489 views

What's my TIO uniqueness?

Try it online! currently has 680 listed languages, all of which are searchable. For most of those languages, when searching for it, you don't have to enter the entire string. For example, entering <...
24 votes
27 answers
2k views

Un-pipe an Elixir expression

Elixir is a programming language with a feature called the pipe operator, |>, similar to the pipe in Bash and other languages. It passes the result of an ...
  • 2,949
10 votes
5 answers
511 views

(Σ*)² ⟲ Σ* (aka Round-Trip a String Pair) [closed]

This is a challenge I thought of recently which I think is not hard but allows for a wide range of possible solutions. Seems like a perfect fit for the creativity of PPCG users :) Your Task Define two ...
  • 709
25 votes
27 answers
1k views

Decode Polybus Square/Tap Code/Prison Code

The code has a lot of names, but is very simple: 1 2 3 4 5 1 A B C D E 2 F G H I J 3 L M N O P 4 Q R S T U 5 V W X Y Z A letter is coded by its coordinates, ...
12 votes
15 answers
789 views

Check if B is composed of substrings of A of length n

Given two strings \$ A \$ and \$ B \$ and a positive integer \$ n \$, determine whether \$ B \$ is composed entirely of (possibly overlapping) strict substrings of \$ A \$ of a length of at least \$ ...
  • 22.6k
27 votes
34 answers
3k views

Rotate brackets until they're balanced

Take the string of brackets ]][][[. When you rotate it to the right once, you get []][][. If you rotate it again, you get ...
4 votes
6 answers
465 views

I Rot-13 the source code, you Rot-19 the output!

This is alternate of a rip-off of a rip-off of a rip-off of a rip-off of a rip-off of a rip-off. Go upvote those! Your task, if you accept it, is to write a program/function that outputs/returns its ...
  • 1,407
20 votes
24 answers
3k views

I palindrome the source code, you palindrome the input!

This is a rip-off of a rip-off of a rip-off of a rip-off of a rip-off. Go upvote those! Your task, if you accept it, is to write a program/function that outputs/returns its input/args. The tricky ...
  • 1,407
-5 votes
17 answers
357 views

Inverse Ax+B/Cx+D sized function

Let's assume that $$ f(x) = \frac{Ax+B}{Cx+D} $$ Where, \$x\$ is a variable and \$A\$,\$B\$,\$C\$,\$D\$ are constants. Now we have to find out the inverse function of \$f(x)\$, mathematically \$f^{-1}(...
  • 12k
8 votes
7 answers
291 views

Find the Best Set of Adapters

I'm trying to plug this really old phone into my computer but the phone seems to use a very obscure plug. Luckily I have some adapters. Unfortunately, I can't figure out which of them to use to ...
  • 1,131
10 votes
1 answer
307 views

Compile Commentscript

Commentscript is a variant on Javascript that I made up for the purpose of this question. Only commented-out code is evaluated. Javascript has two types of comments: ...
  • 31.9k
36 votes
18 answers
4k views

Find the HTTP status code

Given the name of an HTTP status code, such as OK or Continue, output or return the corresponding number. Your code is limited ...
-13 votes
15 answers
293 views

Reverse source code and double the input

For today's challenge you have to take an input, and if your source code is reversed, then the input should be printed doubled. Let's say your source code is ABC ...
's user avatar
11 votes
15 answers
2k views

Alphabet printing challenge

This challenge is related Challenge Your task is to write as many programs/snippets as you can, where each one outputs/prints/ returns an alphabet. The first program must output the letter ...
  • 12k
13 votes
10 answers
1k views

Autogrammatic pairs

For today's task, we have two programs, P and Q, both in the same language. Each of them receives a single-character input. If P receives character K, P says how many times K appeared in Q. (You can ...
15 votes
6 answers
904 views

Convert Gemtext to HTML

Gemtext is a very simple markup format used by the alternative web protocol Gemini. Write a Gemtext to HTML converter. From the Wiki: A line of text is a paragraph, to be wrapped by the client. It is ...
23 votes
11 answers
3k views

Pangram "Hello, World!"

Your challenge: The code must print "Hello, World!" and nothing else. Your restrictions: Your program must satisfy these requirements: The program must be a pangram. It must use every ...
  • 323
26 votes
21 answers
2k views

BalancE the UppercasE

Oh, No! the sentences are out of balance. Quick! balance them. A word is defined as follows: A sequence of letters [A-Za-z] separated by any non-letter character ([0-9] ~+- etc.) A word is BaLanCeD ...
0 votes
0 answers
135 views

Is this an anagram of its own source code? [duplicate]

I like anagrams. I like programs that reference their own source code. So this challenge combines them! Input. The input to the program could be anything, including letters, numbers, symbols, you name ...
  • 323
11 votes
1 answer
223 views

Generating minimal regular expression character classes

Background Character classes are a standard way to indicate a set of characters to match in regular expressions. For example, the class [ab] matches a or b, ...
  • 2,919
17 votes
12 answers
2k views

Make a !!!Batch compiler/translator

!!!Batch is another derivative of the Windows Batch programming language, its wiki is here Your challenge is to create an compiler/translator that reads a !!!Batch program and returns a Windows Batch ...
  • 12k
3 votes
5 answers
266 views

Write A Book Cipher [closed]

Introduction Book cipher A Book cipher is a very unique method of a encipher. Here's how's it done: You have a book / a document or a article (something full of text, the more pages of text the ...
-9 votes
5 answers
490 views

Print your username by ONLY using the characters in your username [closed]

You have to print out your username, by only using the characters in your username. Standard loopholes are forbidden This is not code-golf, so shortest does not win Don't modify your username please ...
  • 12k
19 votes
13 answers
943 views

Count strictly overlapping substrings

Given two strings a and b, count how many times b occurs as a substring in ...
  • 22.6k
17 votes
17 answers
3k views

How likely is this mutation?

In my previous bioinformatics challenge, I asked you to mutate a DNA sequence. This time, I'd like you to evaluate how likely a mutation, or a series of mutations, is. The two types of substitutions ...
  • 583
20 votes
12 answers
5k views

Which Ninjutsu am I casting?

In the MMORPG Final Fantasy XIV, the Ninja class has the ability to use combinations of up to three handsigns (Ten, Chi and Jin) to perform a variety of ninjutsu skills. The skill you cast depends on ...
38 votes
31 answers
2k views

Evaluate left-or-right

Originally sandboxed by @xnor Left-or-right is a very simple language @xnor made up. Its expressions are made of arrows < (left), ...
  • 66.1k
10 votes
8 answers
591 views

Implement bottom (encode)

Challenge The challenge is to implement the bottom encoding (only encoding, not decoding). There is a wide variety of existing implementations in the bottom-software-foundation org. Bottom is a text ...
  • 717
10 votes
15 answers
1k views

Merge Two Paragraphs with Removing Duplicated Lines

Challenge The goal of this challenge is to make a function that takes two paragraphs and output a concatenated result with removing the duplicated overlapped lines due to redundancy (but a single copy ...
  • 403
41 votes
36 answers
7k views

Speed of Lobsters

From the subreddit r/SpeedOfLobsters: Edit the text of an image to create a new phrase This meme format/style is pretty self-explanatory. Simply have a browse through the subreddit if you need more ...
18 votes
14 answers
749 views

Sub-string Extractor with Specific Keywords

Challenge The goal of this challenge is to make a function that takes an input string, a start keyword and a end keyword. The output extracted result is from (but excluded) the given start keyword to (...
  • 403
23 votes
18 answers
1k views

Interpret Interval Notation

Interval notation is a way to write complicated range bounds more conveniently and concisely than writing an inequality. The challenge, should you choose to accept it, is to write a program or ...
  • 2,215
20 votes
19 answers
2k views

Vandalizing Marquees

A marquee is a low-tech board that allows customizable letters. For example, here is a marquee: SALE ON SNEAKERS However, someone might come along and vandalize it ...
  • 13.5k
8 votes
4 answers
1k views

Compute all close strings quickly

Input A string S of length between 10 and 16 inclusive. The characters are taken from the 95 printable ASCII characters, byte values 32 (...
's user avatar
17 votes
8 answers
1k views

How Many Atoms?

Your task is when given a chemical formula as input, output the total number of atoms in the formula. Input A chemical formula in any reasonable format. Each chemical formula has the following: A ...
  • 3,423
24 votes
9 answers
906 views

Animal-Alphabetical Sequence

The Animal-Alphabetical Sequence is an infinite string of letters built accordingly to the following procedure: Start with the letter A; Replace each letter with ...
  • 248
-1 votes
2 answers
176 views

increment a binary number without arithmetic manipulations [closed]

Input: binary string Output: binary string that represents the binary input + 1 Example: Given 10111 as an input, output 11000 ...
26 votes
23 answers
3k views

Help me compress this song

in my country we have a children's song which goes like this: ...
  • 429
20 votes
6 answers
1k views

A Snake, A Camel And A Kebab

As many of you will know, almost every programming language has a standard casing system; unfortunately, we have not been able to agree on a singular system to use and now must frequently switch ...
  • 1,097
8 votes
6 answers
722 views

(1) Determine the amount of statues

Inspired by this stack of little statues that are currently on my desk at work, given to me by my colleagues from Sri Lanka when they visited The Netherlands: This is split into two different ...
7 votes
2 answers
245 views

(2) Can the statues be stacked?

Inspired by this stack of little statues that are currently on my desk at work, given to me by my colleagues from Sri Lanka when they visited The Netherlands: This is split into two different ...
13 votes
7 answers
691 views

Iterate over the neighborhood of a string

Input A string S of length between 2 and 30. The only letters in the string will be a or b. Output All strings within ...
's user avatar

1
3 4
5
6 7
43