People who code: we want your input. Take the Survey

Questions tagged [string]

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

Filter by
Sorted by
Tagged with
26
votes
21answers
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
0answers
122 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 ...
12
votes
1answer
199 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, ...
15
votes
11answers
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 ...
3
votes
5answers
242 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 ...
-7
votes
5answers
324 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 ...
18
votes
13answers
808 views

Count strictly overlapping substrings

Given two strings a and b, count how many times b occurs as a substring in ...
17
votes
17answers
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 ...
20
votes
12answers
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 ...
30
votes
24answers
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), ...
10
votes
8answers
538 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 ...
10
votes
15answers
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 ...
37
votes
33answers
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
14answers
705 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 (...
22
votes
18answers
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 ...
20
votes
19answers
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 ...
10
votes
4answers
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 (...
14
votes
8answers
1k views

How Many Atoms?

How Many Atoms? Write the shortest code that when given a chemical formula as input, outputs the total number of atoms in the formula. Input A chemical formula in any reasonable format. Each chemical ...
24
votes
9answers
885 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 ...
-1
votes
2answers
136 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 ...
25
votes
22answers
3k views

Help me compress this song

in my country we have a children's song which goes like this: ...
20
votes
6answers
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 ...
8
votes
6answers
695 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
2answers
228 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
7answers
653 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 ...
19
votes
21answers
1k views

Scramble a Megaminx!

Scramble a Megaminx! A megaminx is a dodecahedral version of the familiar Rubik's cube. Since 2008, the World Cube Association uses Stefan Pochmann's megaminx scrambler. The scrambles look like this: <...
12
votes
9answers
755 views

Mimic the X11 Primary selection

Background In X11 (a windowing system used by a lot of Unix-like OS), what you would call the clipboard behave a bit differently than on other OSes like MacOS or Windows. While the "traditional&...
31
votes
7answers
5k views

Translate English to English

You have been hired by the American embassy in the UK to act as a translator. Being a programmer, you decide to write a program to do a bit of the work for you. You've found out that often just doing ...
11
votes
21answers
3k views

Advent of Code 2020, Day 2, Part 1

Today, my girlfriend and I started with this year's Advent of Code to improve our Python. So far we only did Day 1 and the first part of Day 2. The latter, I found to be very fun, so, to spice it up a ...
21
votes
20answers
1k views

Compatible strings

When studying numerology, you can say two words (strings consisting entirely of letters) are compatible if they produce the same number under the following operation (let's use the string ...
18
votes
17answers
511 views

Align a list of numbers [duplicate]

Perhaps something like this is here already, but I couldn't find it. It is not the same as Aligning Lines!. Example: Input: 98.6 $2,750.17 -$23 -86 3,120,487.19 ...
1
vote
1answer
377 views

Hacker Challenge: Guess the Correct Password

In an attempt to “liberate” their fellow birds, a group of highly intelligent hens are attempting to compromise the zoo’s security system. To get access to the zoo’s mainframe, the hens first need to ...
18
votes
29answers
4k views

Is It A Rainbow Color?

Challenge: The challenge is to determine whether or not a color, given it's name, is one of the colors in the rainbow. When supplied with a color, your program should output a truthy value if it is a ...
6
votes
8answers
855 views

Bi-directional translator

Bi-directional translator The challenge is to create a translator that can translate a [a-zA-Z ] string into another string according to the mappings below. The ...
6
votes
3answers
580 views

Day of Week - Natural language processing and date parsing

You'll get a human-readable question matching one of the following syntaxes, and are expected to print/return the corresponding result. Finding similarities between the human-readable inputs and ...
17
votes
4answers
1k views

Simulate my keyboard wave light!

(The word frame in the following text does not mean an actual frame, it is used as a placeholder for an undefined time unit) The task Imagine you have a keyboard layout with only letters like so: <...
21
votes
27answers
2k views

Get the Systematic Chemical Symbol

Background The systematic chemical symbol is defined as such for \$ 118 < n < 1000 \$: The first letter corresponds to the first digit, capitalized. The second letter corresponds to the second ...
37
votes
17answers
4k views

Is it a digit haiku?

We can read 13576870234289 digit-by-digit in English, and it makes a haiku: one three five seven six eight seven zero two three four two eight nine We say it's a &...
7
votes
2answers
199 views

Unscramble the letters by letter frequency analysis [closed]

You know those riddles where every letter is swapped for another letter? E.g. you get a text like ...
14
votes
8answers
2k views

We're much closer than you think

Martin Ender's 2D programming language Alice has two different modes depending on what orientation the IP has: orthogonal (Cardinal mode) or diagonal (Ordinal mode). Commands in Alice change their ...
16
votes
23answers
2k views

Create an Accurate How-To Article

Here is an easy-intermediate challenge for anyone interested! What is that? A thing me and brother do a bit too often is this: One of us has a problem and asks the other to explain how to do certain ...
25
votes
13answers
2k views

Decide a C integer literal

Objective Given an ASCII string, decide whether it is a valid C integer literal. C integer literal A C integer literal consists of: One of: 0 followed by zero or ...
22
votes
44answers
3k views

Converting Strings to Decimals (Gone Wrong)

What? Many programming languages, both practical and esoteric, have functions, methods, etc to convert a given string to a decimal number. This is how the process might work: For each character in ...
10
votes
6answers
763 views

Parse a Scala expression

Scala isn't a very commonly used language around here. Most of those who know it like it[citation needed], but some go :\ when they encounter its user-defined ...
19
votes
16answers
2k views

Size up a number

Intro Given a whole number \$< 100,\$ extend/shorten the english representation of the number to have as many characters as it's value. Sandbox Rules Take the number \$n\$, and get it in words ...
14
votes
15answers
2k views

Palindrome distance

Find what is the distance for a given string to its closest palindrome of the same length. For this task I decided to give the characters further away from the string's center more weight (think of it ...
3
votes
4answers
1k views

Parse a nested parentheses

Objective Mimic Haskell's reads :: ReadS (). Or in other words, parse nested parentheses. Since the target type is () (the type ...
16
votes
27answers
2k views

Compactify the query string

Introduction Just on Hacker news, John Resig contemplates transforming a query “foo=1&foo=2&foo=3&blah=a&blah=b” into one that looks like this: “foo=1,2,3&blah=a,b", https://...
20
votes
23answers
1k views

Find the result of some assignment statements

In this challenge, the goal is to find the values of some variables after a number of assignments are done. An example input: a = 5 b = 4 c = a = b a = 2 b = a ...
16
votes
3answers
950 views

Will all the dominoes fall?

The purpose of this challenge is to figure out whether all the dominoes will fall, given an input string representing a top view of the table. Input format The program can take the input as a single ...

1
2
3 4 5
39