Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [string]

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

57
votes
42answers
10k views

Oreoorererereoo

Oreoorererereoo Given an input string that is similar to the word "oreo", give an ASCII representation of the cookie that is as wide as the input string (to ensure cookie stability). Rules The ...
14
votes
13answers
4k views

Name of Frankenstein's Monster

Introduction: Since it's almost Halloween, I was just thinking of some random Halloween-themed challenges. Eventually I was reading through Frankenstein's wikipedia page, and came across the ...
19
votes
45answers
2k views

String rotation - output string repeatedly moving first character to the end

The challenge here is to take a string and output all its rotations, by repeatedly moving the first character to the end, once per character in the string, ending with the original string: ...
4
votes
6answers
399 views

Corrupting A Binary File By Interpreting It As Text

Using FTP's ASCII mode to transfer binary files is a bad idea. It is likely to corrupt your data. Badly. Let's simulate this corruption! Your task is to write a program which takes a file as input ...
25
votes
3answers
1k views

Balance the Brackets

Your objective: Given a string of brackets, output the minimum Damerau-Levenshtein Distance required to turn the input string into a string where the brackets are balanced. Input The input string ...
75
votes
127answers
21k views

The shortest code to invert bit-wise a binary string

Me thinks there aren't enough easy questions on here that beginners can attempt! The challenge: Given a random input string of 1's and 0's such as: ...
-3
votes
0answers
77 views

Split Longer Message to multiple short messages [duplicate]

Post short messages limited to 50 Example "I can't believe Tweeter now supports chunking my messages, so I don't have to do it myself." This is 91 ...
14
votes
7answers
709 views

Code the Huffman!

Or else he will huff and puff and blow your house down! That was completely irrelevant. This challenge is actually about Huffman coding. The gist of it is the frequency of characters in a given text ...
0
votes
0answers
105 views

Find is string is magic or not [closed]

A string is a magic string if It consists of only digits Is a concatenation of 8 unique integers between 1 and 80 Challenge Write code which, given a string as input, outputs all the lists of ...
13
votes
13answers
482 views

Write a function/method that takes in a string and spells that word out using the NATO Phonetic Alphabet. Titlecase optional

Write a program that takes in a string and spells that word out using the NATO Phonetic Alphabet. The mapping is as follows: ...
84
votes
28answers
4k views

Vertically collapse text

Say I have text like this (each word on one line, with no spaces) Programming Puzzles & Code Golf That makes no sense! It totally defies the laws of physics. ...
21
votes
28answers
2k views

Make a simple word wrapper

(Note: This is my first ever code golf question, but as far as I can tell, nobody else has done exactly this, so I should be good.) Your task is to make a program or function that takes in a string <...
75
votes
54answers
6k views

From Programming Puzzles to Code Golf

Your task is to write a program that outputs the exact string Programming Puzzles (trailing newline optional), but when all spaces, tabs, and newlines are removed ...
6
votes
11answers
374 views

Mis-decode a date

Background Inspired by a now deleted question by John Burger from which I quote: Now obviously no human made this mistake. It's a mis-decode of something - perhaps the ISBN? My question is: ...
19
votes
19answers
2k views

Let's build a Staircase

We don't have enough (semi-)easy challenges for beginners. More and more of the easy ones are already taken. So I tried to come up with something that might be achievable by beginners, but that isn't ...
36
votes
18answers
3k views

Print the nth prime that contains n

This question will be a twist on finding the nth prime number. Challenge You must write a program that will take one input n, ...
21
votes
9answers
817 views

Words crossing over

Input: Two strings (NOTE: the order of input is important). Output: Both words/sentences start on lines with one empty line in between them. They 'walk' horizontally 'next to each other'. But when ...
29
votes
15answers
3k views

Fridge magnet substitution

When writing a message with fridge magnets, you'll often find yourself substituting a 1 for an I. In this challenge, your goal ...
387
votes
729answers
112k views

“Hello, World!”

So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with hello-world, and counting). While this is not the most ...
6
votes
12answers
842 views

Decode a Rövarspråket string

This question is the inverse of this one by James Williams. Rövarspråket Rövarspråket is a word game played by Swedish children, from the books about Kalle Blomkvist by Astrid Lindgren. The basic ...
49
votes
30answers
5k views

Encode the date in Christmas Eve format

The day this post was published was Christmas Eve. Tomorrow will be Christmas. Yesterday was Christmas Eve Eve. In two days it will be ...
12
votes
14answers
1k views

Clock (transliterate) Cipher

Introduction: I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too ...
5
votes
0answers
116 views

Pattern Finder - Find Repeated Pattern in String [closed]

Introduction This is a little challenge with the goal of identifying repeated pattern "blocks" in a string, and outputting them with their frequency of occurence from left to right. A friend asked ...
18
votes
30answers
2k views

Remove common leading spaces

When coding in Python, sometimes you want a multiline string within a function, e.g. def f(): s = """\ Line 1 Line 2 Line 3""" (The backslash is ...
19
votes
30answers
1k views

Generate an Acronym

This is similar to Making an acronym, but there are several key differences, including the method of fetching the acronym, and this challenge including flexible output. Task Given a string (list of ...
0
votes
1answer
75 views

Remove indentation [duplicate]

Write a program which removes any common leading spaces from the input string. For example, if the least indented line started with 3 spaces, and every other line has ...
82
votes
76answers
9k views

Unique is Cheap

Write a function or program that determines the cost of a given string, where the cost of each character equals the number of how many times the character has occurred up to this point in the string,...
10
votes
15answers
1k views

Find a recursive acronym

Introduction A recursive acronym is an acronym that contains or refers to itself, for example: Fish could be a recursive acronym for ...
24
votes
35answers
2k views

Ratio of Uppercase Letters to Lowercase

In this challenge you and your friends are debating on which case is better, uppercase or lowercase? To find out, you write a program to do this for you. Because esolangs scare your friends, and ...
24
votes
50answers
6k views

Convert a string of binary characters to the ASCII equivalents

Take a string of binary characters separated by a space, and convert it to an ASCII string. For example... ...
24
votes
61answers
6k views

Find the longest word in an array

Your challenge is to take an array of strings and output the longest string in the array. So for ["tiny", "small", "bigger", "biggest"] the output would be ...
22
votes
10answers
3k views

Is this square symmetrical?

Write a program or function that takes in a 4×4 text grid consisting of exactly 4 A's, 4 B's, 4 ...
42
votes
23answers
2k views

Parse the Bookworm dictionary format

I've recently been indulging myself in some nostalgia in the form of Bookworm Deluxe: In case you haven't seen it before, it's a word game where the goal is to connect adjacent tiles to form words. ...
24
votes
16answers
2k views

Monday Mini-Golf #3: Anagram distance

Monday Mini-Golf: A series of short code-golf challenges, posted (hopefully!) every Monday. (Sorry this one's a little late.) I'm sure most of you folks have heard of Levenshtein distance, an ...
80
votes
254answers
15k views

Simple cat program

One of the most common standard tasks (especially when showcasing esoteric programming languages) is to implement a "cat program": read all of STDIN and print it to STDOUT. While this is named after ...
18
votes
25answers
1k views

CodeGolf - Heads or Tails

Instructions Given an unknown input string i with a value of either heads or tails, return 1 for heads or ...
48
votes
10answers
2k views

Monday Mini-Golf #6: Meeesesessess upp teeexexextext

Monday Mini-Golf: A series of short code-golf challenges, posted (hopefully!) every Monday. True story1: The other day, I was playing around on my tablet when I had the idea to visit the page I ...
51
votes
69answers
4k views

Same length, different string

Challenge Given a non-empty string S of length L consisting entirely of printable ASCII chars, output another string of length L that consists entirely of printable ASCII chars, but is not equal to S....
25
votes
21answers
2k views

Monday Mini-Golf #2: Truncating long text

Monday Mini-Golf: A series of short code-golf challenges, posted (hopefully!) every Monday. Many web applications (especially social media) automatically truncate long passages of text so they fit ...
21
votes
39answers
5k views

Is string X a subsequence of string Y?

Given strings X and Y, determine whether X is a subsequence of Y. The empty string is regarded as a subsequence of every string. (E.g., '' and ...
165
votes
25answers
19k views

Do you want to code a snowman?

Here is a simple ASCII art snowman: _===_ (.,.) ( : ) ( : ) Let's make him some friends. This will be the general pattern for our ASCII art snowpeople: ...
2
votes
16answers
969 views

Concise case changing code

Create the shortest program that given an input string it outputs the opposite-cased string. For example if I pass the string "HeLlO" the program should output <...
34
votes
13answers
2k views

Fond Memories of Past Primes

Consider a prime number p, written in base 10. The memory of p is defined as the number of distinct primes strictly less than p that are contained as substrings of p. Challenge Given a non-negative ...
25
votes
22answers
3k views

Find the first word starting with each letter

Given a string, find the first word starting with each letter (case insensitive). Sample Using Ferulas flourish in gorgeous gardens. as input: ...
188
votes
56answers
15k views

No A, just CAPS LOCK

What happens when the CapsLock key on your keyboard doesn't have a notch in it? "This hPPENS." The goal of this program is to consistently emulate keyboard misses where each A press is replaced with ...
47
votes
70answers
4k views

Bernardino identifies unaltered dollar words

Definition A dollar word is a word where when each of its letters is given a cent value, from a = 1 to z = 26, and the letters are summed, the result is 100. Here is an example on CodeReview, and ...
16
votes
10answers
568 views

Align function arguments on their own lines

Given an input of a string representing a function definition, output the string with newlines and spaces inserted so that the function's arguments are newline-separated and aligned. The input string ...
26
votes
21answers
2k views

Reimplement the wc coreutil

This challenge is similar to this old one, but with some unclear parts of the spec hammered out and less strict I/O requirements. Given an input of a string consisting of only printable ASCII and ...
6
votes
48answers
2k views

String analyser

Use any programming language to display "AWSALILAND" in such a way, so that each letter is in a new line and repeated as many times as its position in the English alphabet. For example letter, (A) ...
26
votes
30answers
3k views

Write a program that reverses the name of its source file

In a single file, write a program that requires no input and produces no output. When run it should reverse the name of the file it is contained in, regardless of what the name is, without altering ...