String Data Structure - GeeksforGeeks

16 Jul, 2021
Strings are defined as an array of characters. The difference between a character array and a string is the string is terminated with a special character ‘\0’.
Declaring a string is as simple as declaring a one dimensional array. Below is the basic syntax for declaring a string in C programming language.
char str_name[size];

Topics :
Basics
String in C & C++
Strings in Java
String in Python
Arthimetic Operation in String
Character Counting Based Problems
Subsequence & Substring
Reverse & Rotation
Sorting & Searching
Case Sensitive String
Occurrence Based String
Spacing
Anagram
Palindrome
Binary String
Lexicographic pattern
Pattern Searching
Split String
Balance Parentheses & Bracket Evaluation
Conversion
Misc
Quick Links
Basics :
Function to copy stringPangram CheckingMissing characters to make a string PangramCheck if a string is Pangrammatic LipogramRemoving punctuations from a given stringRearrange characters in a string such that no two adjacent are sameProgram to check if input is an integer or a stringQuick way to check if all the characters of a string are sameProgram to find the initials of a nameCheck Whether a number is Duck Number or notRound the given number to nearest multiple of 10Change string to a new character setFind one extra character in a string
Function to copy string
Pangram Checking
Missing characters to make a string Pangram
Check if a string is Pangrammatic Lipogram
Removing punctuations from a given string
Rearrange characters in a string such that no two adjacent are same
Program to check if input is an integer or a string
Quick way to check if all the characters of a string are same
Program to find the initials of a name
Check Whether a number is Duck Number or not
Round the given number to nearest multiple of 10
Change string to a new character set
Find one extra character in a string
Strings in C & C++ :
Array of Strings in C++ (3 Different Ways to Create)Strings in CStorage for Strings in Csprintf() in CC program to find second most frequent characterC Program to Sort an array of names or stringsC++ Program to remove spaces from a stringString Class in C++C++ program to concatenate a string given number of timesstd::string::append vs std::string::push_back() vs Operator += in C++Comparing two strings in C++Convert string to char array in C++Extract all integers from string in C++std::regex_match, std::regex_replace() | Regex (Regular Expression) In C++C program to Replace a word in a text by another given wordstringstream in C++ and its applicationsC++ string class and its applications
Array of Strings in C++ (3 Different Ways to Create)
Strings in C
Storage for Strings in C
sprintf() in C
C program to find second most frequent character
C Program to Sort an array of names or strings
C++ Program to remove spaces from a string
String Class in C++
C++ program to concatenate a string given number of times
std::string::append vs std::string::push_back() vs Operator += in C++
Comparing two strings in C++
Convert string to char array in C++
Extract all integers from string in C++
std::regex_match, std::regex_replace() | Regex (Regular Expression) In C++
C program to Replace a word in a text by another given word
stringstream in C++ and its applications
C++ string class and its applications
Strings in Java :
String Class in JavaString in Switch Case in JavaJava program to swap first and last characters of words in a sentenceJava program to expand a String if range is given?Check if a given string is a valid number (Integer or Floating Point) in Java | SET 2 (Regular Expression approach)Get the first letter of each word in a string using regex in JavaReverse words in a given String in JavaReverse a string in Java (5 Different Ways)Compare two strings lexicographically in JavaSearching characters and substring in a String in JavaPossible Words using given characters in PythonUsing Set() in Python Pangram CheckingUsing OrderedDict() in Python to check order of characters in stringPrint anagrams together in Python using List and DictionaryK’th Non-repeating Character in Python using List Comprehension and OrderedDictPrefix matching in Python using pytrie modulePrint number with commas as 1000 separators in PythonPattern Occurrences : Stack Implementation Java
String Class in Java
String in Switch Case in Java
Java program to swap first and last characters of words in a sentence
Java program to expand a String if range is given?
Check if a given string is a valid number (Integer or Floating Point) in Java | SET 2 (Regular Expression approach)
Get the first letter of each word in a string using regex in Java
Reverse words in a given String in Java
Reverse a string in Java (5 Different Ways)
Compare two strings lexicographically in Java
Searching characters and substring in a String in Java
Possible Words using given characters in Python
Using Set() in Python Pangram Checking
Using OrderedDict() in Python to check order of characters in string
Print anagrams together in Python using List and Dictionary
K’th Non-repeating Character in Python using List Comprehension and OrderedDict
Prefix matching in Python using pytrie module
Print number with commas as 1000 separators in Python
Pattern Occurrences : Stack Implementation Java
Strings in Python :
String Methods in Python : Set 1 , Set 2 , Set 3Dictionary and counter in Python to find winner of electionMaximum length of consecutive 1’s in a binary string in Python using Map functionPython code to print common characters of two Strings in alphabetical orderUsing Counter() in Python to find minimum character removal to make two strings anagramReverse string in PythonPython groupby method to remove all consecutive duplicatesGenerate two output strings depending upon occurrence of character in input string in PythonPython Dictionary to find mirror characters in a stringPython | Convert a list of characters into a stringMap function and Lambda expression in Python to replace charactersZip function in Python to change to a new character setSequenceMatcher in Python for Longest Common SubstringPython | Print the initials of a name with last name in fullPython counter and dictionary intersection example (Make a string using deletion and rearrangement)Python program to count number of vowels using sets in given stringPython set to check if string is panagramPython | Check if a Substring is Present in a Given StringPython sorted() to check if two strings are anagram or notPython | Remove leading zeros from an IP addressPython | Count all prefixes in given string with greatest frequencyCheck if both halves of the string have same set of characters in PythonConcatenated string with uncommon characters in PythonSecond most repeated word in a sequence in PythonRegex in Python to put spaces between words starting with capital lettersPython code to move spaces to front of string in single traversalString slicing in Python to rotate a stringString slicing in Python to check if a string can become empty by recursive deletionReverse words in a given String in PythonRun Length Encoding in PythonAnagram checking in Python using collections.Counter()Remove all duplicates from a given string in PythonRemove all consecutive duplicates from the stringPython program to check if a string is palindrome or not
String Methods in Python : Set 1 , Set 2 , Set 3
Dictionary and counter in Python to find winner of election
Maximum length of consecutive 1’s in a binary string in Python using Map function
Python code to print common characters of two Strings in alphabetical order
Using Counter() in Python to find minimum character removal to make two strings anagram
Reverse string in Python
Python groupby method to remove all consecutive duplicates
Generate two output strings depending upon occurrence of character in input string in Python
Python Dictionary to find mirror characters in a string
Python | Convert a list of characters into a string
Map function and Lambda expression in Python to replace characters
Zip function in Python to change to a new character set
SequenceMatcher in Python for Longest Common Substring
Python | Print the initials of a name with last name in full
Python counter and dictionary intersection example (Make a string using deletion and rearrangement)
Python program to count number of vowels using sets in given string
Python set to check if string is panagram
Python | Check if a Substring is Present in a Given String
Python sorted() to check if two strings are anagram or not
Python | Remove leading zeros from an IP address
Python | Count all prefixes in given string with greatest frequency
Check if both halves of the string have same set of characters in Python
Concatenated string with uncommon characters in Python
Second most repeated word in a sequence in Python
Regex in Python to put spaces between words starting with capital letters
Python code to move spaces to front of string in single traversal
String slicing in Python to rotate a string
String slicing in Python to check if a string can become empty by recursive deletion
Reverse words in a given String in Python
Run Length Encoding in Python
Anagram checking in Python using collections.Counter()
Remove all duplicates from a given string in Python
Remove all consecutive duplicates from the string
Python program to check if a string is palindrome or not
Arthimetic Operation in String :
Smallest number with sum of digits as N and divisible by 10^NMinimum sum of squares of character counts in a given string after removing k charactersMaximum and minimum sums from two numbers with digit replacementsCheck if a given string is sum-stringSum of two large numbersCalculate sum of all numbers present in a stringExtract maximum numeric value from a given stringCalculate maximum value using ‘+’ or ‘*’ sign between two numbers in a stringMaximum segment value after putting k breakpoints in a numberDifference of two large numbersCheck if a large number is divisible by 4 or notCheck if a large number is divisible by 11 or notNumber of substrings divisible by 6 in a string of integersDecimal representation of given binary string is divisible by 5 or notNumber of substrings divisible by 8 but not by 3To check divisibility of any large number by 999Multiply Large Numbers represented as StringsDivide large number represented as stringRemainder with 7 for large numbersGiven two numbers as strings, find if one is a power of otherCheck whether a given number is even or oddProduct of nodes at k-th level in a tree represented as stringProgram to find remainder when large number is divided by 11Ways to remove one element from a binary string so that XOR becomes zeroFind the maximum subarray XOR in a given arrayCalculate the difficulty of a sentenceMinimum Index Sum for Common Elements of Two Lists
Smallest number with sum of digits as N and divisible by 10^N
Minimum sum of squares of character counts in a given string after removing k characters
Maximum and minimum sums from two numbers with digit replacements
Check if a given string is sum-string
Sum of two large numbers
Calculate sum of all numbers present in a string
Extract maximum numeric value from a given string
Calculate maximum value using ‘+’ or ‘*’ sign between two numbers in a string
Maximum segment value after putting k breakpoints in a number
Difference of two large numbers
Check if a large number is divisible by 4 or not
Check if a large number is divisible by 11 or not
Number of substrings divisible by 6 in a string of integers
Decimal representation of given binary string is divisible by 5 or not
Number of substrings divisible by 8 but not by 3
To check divisibility of any large number by 999
Multiply Large Numbers represented as Strings
Divide large number represented as string
Remainder with 7 for large numbers
Given two numbers as strings, find if one is a power of other
Check whether a given number is even or odd
Product of nodes at k-th level in a tree represented as string
Program to find remainder when large number is divided by 11
Ways to remove one element from a binary string so that XOR becomes zero
Find the maximum subarray XOR in a given array
Calculate the difficulty of a sentence
Minimum Index Sum for Common Elements of Two Lists
Character Counting Based Problems :
Count Uppercase, Lowercase, special character and numeric valuesFind the smallest window in a string containing all characters of another stringSmallest window that contains all characters of string itselfCount number of substrings with exactly k distinct charactersNumber of substrings with count of each character as kString with k distinct characters and no same characters adjacentNumber of substrings of a stringDistinct strings with odd and even changes allowedFind k’th character of decrypted stringCount characters at same position as in English alphabetsCount words in a given stringCount words present in a stringCount of words whose i-th letter is either (i-1)-th, i-th, or (i+1)-th letter of given wordProgram to find Smallest and Largest Word in a StringCount substrings with same first and last charactersRecursive solution to count substrings with same first and last charactersCount of distinct substrings of a string using Suffix ArrayCount of distinct substrings of a string using Suffix TrieCount number of strings (made of R, G and B) using given combinationCount of strings that can be formed using a, b and c under given constraintsCount of substrings of a binary string containing K onesGroup words with same set of charactersPrint all distinct characters of a string in order (3 Methods)Print common characters of two Strings in alphabetical orderCommon characters in n stringsFind uncommon characters of the two stringsConcatenated string with uncommon characters of two stringsProgram to remove vowels from a StringRemove consecutive vowels from stringProgram to count vowels in a string (Iterative and Recursive)Count consonants in a string (Iterative and recursive methods)Alternate vowel and consonant stringGiven a binary string, count number of substrings that start and end with 1Number of distinct permutation a String can haveTime complexity of all permutations of a stringPermutations of a given string using STLCheck if both halves of the string have same set of charactersCount words that appear exactly two times in an array of wordsCheck if frequency of all characters can become same by one removalCheck if a string has all characters with same frequency with one variation allowedCount ways to increase LCS length of two strings by oneFind the character in first string that is present at minimum index in second stringRemove characters from the first string which are present in the second stringLength of Longest sub-string that can be removedCount of character pairs at same distance as in English alphabetsCount number of equal pairs in a stringCount of strings where adjacent characters are of difference onePrint number of words, vowels and frequency of each character
Count Uppercase, Lowercase, special character and numeric values
Find the smallest window in a string containing all characters of another string
Smallest window that contains all characters of string itself
Count number of substrings with exactly k distinct characters
Number of substrings with count of each character as k
String with k distinct characters and no same characters adjacent
Number of substrings of a string
Distinct strings with odd and even changes allowed
Find k’th character of decrypted string
Count characters at same position as in English alphabets
Count words in a given string
Count words present in a string
Count of words whose i-th letter is either (i-1)-th, i-th, or (i+1)-th letter of given word
Program to find Smallest and Largest Word in a String
Count substrings with same first and last characters
Recursive solution to count substrings with same first and last characters
Count of distinct substrings of a string using Suffix Array
Count of distinct substrings of a string using Suffix Trie
Count number of strings (made of R, G and B) using given combination
Count of strings that can be formed using a, b and c under given constraints
Count of substrings of a binary string containing K ones
Group words with same set of characters
Print all distinct characters of a string in order (3 Methods)
Print common characters of two Strings in alphabetical order
Common characters in n strings
Find uncommon characters of the two strings
Concatenated string with uncommon characters of two strings
Program to remove vowels from a String
Remove consecutive vowels from string
Program to count vowels in a string (Iterative and Recursive)
Count consonants in a string (Iterative and recursive methods)
Alternate vowel and consonant string
Given a binary string, count number of substrings that start and end with 1
Number of distinct permutation a String can have
Time complexity of all permutations of a string
Permutations of a given string using STL
Check if both halves of the string have same set of characters
Count words that appear exactly two times in an array of words
Check if frequency of all characters can become same by one removal
Check if a string has all characters with same frequency with one variation allowed
Count ways to increase LCS length of two strings by one
Find the character in first string that is present at minimum index in second string
Remove characters from the first string which are present in the second string
Length of Longest sub-string that can be removed
Count of character pairs at same distance as in English alphabets
Count number of equal pairs in a string
Count of strings where adjacent characters are of difference one
Print number of words, vowels and frequency of each character
Subsequence & Substring :
Longest subsequence where every character appears at-least k timesGiven two strings, find if first string is a subsequence of secondNumber of subsequences of the form a^i b^j c^kNumber of subsequences in a string divisible by nFind number of times a string occurs as a subsequence in given stringNumber of subsequences as “ab” in a string repeated K timesCount of ‘GFG’ Subsequences in the given stringCount Distinct SubsequencesCount distinct occurrences as a subsequenceLongest common subsequence with permutations allowedRepeated subsequence of length 2 or morePrint all longest common sub-sequences in lexicographical orderPrinting Longest Common Subsequence | Set 2Given number as string, find number of contiguous subsequences which recursively add up to 9 | Set 2Shortest Uncommon SubsequenceShortest Superstring ProblemPrinting Shortest Common SupersequenceShortest possible combination of two stringsA Space Optimized Solution of LCSSort a string according to the order defined by another stringShortest Common SupersequenceLongest Repeating SubsequenceFind largest word in dictionary by deleting some characters of given stringDynamic Programming | Set 12 (Longest Palindromic Subsequence)
Longest subsequence where every character appears at-least k times
Given two strings, find if first string is a subsequence of second
Number of subsequences of the form a^i b^j c^k
Number of subsequences in a string divisible by n
Find number of times a string occurs as a subsequence in given string
Number of subsequences as “ab” in a string repeated K times
Count of ‘GFG’ Subsequences in the given string
Count Distinct Subsequences
Count distinct occurrences as a subsequence
Longest common subsequence with permutations allowed
Repeated subsequence of length 2 or more
Print all longest common sub-sequences in lexicographical order
Printing Longest Common Subsequence | Set 2
Given number as string, find number of contiguous subsequences which recursively add up to 9 | Set 2
Shortest Uncommon Subsequence
Shortest Superstring Problem
Printing Shortest Common Supersequence
Shortest possible combination of two strings
A Space Optimized Solution of LCS
Sort a string according to the order defined by another string
Shortest Common Supersequence
Longest Repeating Subsequence
Find largest word in dictionary by deleting some characters of given string
Dynamic Programming | Set 12 (Longest Palindromic Subsequence)
More >>
Reverse & Rotation :
Perfect reversible stringReversing an EquationLeft Rotation and Right Rotation of a StringGenerate all rotations of a given stringMinimum rotations required to get the same stringCheck if strings are rotations of each other or notCheck if a string can be obtained by rotating another string 2 placesCount rotations divisible by 4Check if all rows of a matrix are circular rotations of each otherPrint reverse of a string using recursionPrint words of a string in reverse orderProgram to reverse a string (Iterative and Recursive)Write a program to reverse an array or stringReverse an array without affecting special charactersReverse words in a given stringReverse individual wordsReverse a string preserving space positionsReverse string without using any temporary variablePrint reverse string after removing vowelsReverse vowels in a given stringReverse String according to the number of wordsReverse each word in a linked list nodeFind if an array of strings can be chained to form a circle
Perfect reversible string
Reversing an Equation
Left Rotation and Right Rotation of a String
Generate all rotations of a given string
Minimum rotations required to get the same string
Check if strings are rotations of each other or not
Check if a string can be obtained by rotating another string 2 places
Count rotations divisible by 4
Check if all rows of a matrix are circular rotations of each other
Print reverse of a string using recursion
Print words of a string in reverse order
Program to reverse a string (Iterative and Recursive)
Write a program to reverse an array or string
Reverse an array without affecting special characters
Reverse words in a given string
Reverse individual words
Reverse a string preserving space positions
Reverse string without using any temporary variable
Print reverse string after removing vowels
Reverse vowels in a given string
Reverse String according to the number of words
Reverse each word in a linked list node
Find if an array of strings can be chained to form a circle
Sorting & Searching :
Sort an array of strings according to string lengthsSorting array of strings (or words) using TrieSort string of charactersAlternate Lower Upper String SortProgram to sort string in descending orderPrint array of strings in sorted order without copying one string into anotherSort the given string using character searchGiven a sorted dictionary of an alien language, find order of charactersRearrange a string in sorted order followed by the integer sumPrint distinct sorted permutations with duplicates allowed in inputMinimum cost to sort strings using reversal operations of different costsPrint number in ascending order which contains 1, 2 and 3 in their digits.Search in an array of strings where non-empty strings are sortedSparse Search
Sort an array of strings according to string lengths
Sorting array of strings (or words) using Trie
Sort string of characters
Alternate Lower Upper String Sort
Program to sort string in descending order
Print array of strings in sorted order without copying one string into another
Sort the given string using character search
Given a sorted dictionary of an alien language, find order of characters
Rearrange a string in sorted order followed by the integer sum
Print distinct sorted permutations with duplicates allowed in input
Minimum cost to sort strings using reversal operations of different costs
Print number in ascending order which contains 1, 2 and 3 in their digits.
Search in an array of strings where non-empty strings are sorted
Sparse Search
Case Sensitive String :
Lower case to upper case – An interesting factisupper() and islower() and their application in C++Case conversion (Lower to Upper and Vice Versa) of a string using BitWise operators in C/C++Maximum distinct lowercase alphabets between two uppercaseFirst uppercase letter in a string (Iterative and Recursive)Convert characters of a string to opposite casegOOGLE cASE of a given sentencePrint all words matching a pattern in CamelCase Notation DictonaryCamel case of a given sentencePermute a string by changing caseToggle case of a string using Bitwise OperatorsHow to design a tiny URL or URL shortener?
Lower case to upper case – An interesting fact
isupper() and islower() and their application in C++
Case conversion (Lower to Upper and Vice Versa) of a string using BitWise operators in C/C++
Maximum distinct lowercase alphabets between two uppercase
First uppercase letter in a string (Iterative and Recursive)
Convert characters of a string to opposite case
gOOGLE cASE of a given sentence
Print all words matching a pattern in CamelCase Notation Dictonary
Camel case of a given sentence
Permute a string by changing case
Toggle case of a string using Bitwise Operators
How to design a tiny URL or URL shortener?
Occurrence Based String :
Given a string, find its first non-repeating characterPrint all permutations with repetition of charactersFind the first non-repeating character from a stream of charactersConvert to a string that is repetition of a substring of k lengthSmallest length string with repeated replacement of two distinct adjacentDistributing all balls without repetitionMaximum consecutive repeating character in stringMinimum number of deletions so that no two consecutive are sameK’th Non-repeating CharacterFind repeated character present first in a stringFind the first repeated word in a stringFind the first repeated character in a stringSecond most repeated word in a sequenceMost frequent word in an array of stringsEfficiently find first repeated character in a string without using any additional data structure in one traversalQueries for characters in a repeated stringReturn maximum occurring character in an input stringGenerate two output strings depending upon occurrence of character in input string.Print characters and their frequencies in order of occurrenceProgram to count occurrence of a given character in a stringCheck if all occurrences of a character appear togetherGroup all occurrences of characters according to first appearancePrint the string by ignoring alternate occurrences of any characterPrint the string after the specified character has occurred given no. of timesFind all occurrences of a given word in a matrixReplace all occurrences of string AB with C without using extra spaceRearrange a binary string as alternate x and y occurrencesRemove recurring digits in a given numberFind the most frequent digit without using array/string
Given a string, find its first non-repeating character
Print all permutations with repetition of characters
Find the first non-repeating character from a stream of characters
Convert to a string that is repetition of a substring of k length
Smallest length string with repeated replacement of two distinct adjacent
Distributing all balls without repetition
Maximum consecutive repeating character in string
Minimum number of deletions so that no two consecutive are same
K’th Non-repeating Character
Find repeated character present first in a string
Find the first repeated word in a string
Find the first repeated character in a string
Second most repeated word in a sequence
Most frequent word in an array of strings
Efficiently find first repeated character in a string without using any additional data structure in one traversal
Queries for characters in a repeated string
Return maximum occurring character in an input string
Generate two output strings depending upon occurrence of character in input string.
Print characters and their frequencies in order of occurrence
Program to count occurrence of a given character in a string
Check if all occurrences of a character appear together
Group all occurrences of characters according to first appearance
Print the string by ignoring alternate occurrences of any character
Print the string after the specified character has occurred given no. of times
Find all occurrences of a given word in a matrix
Replace all occurrences of string AB with C without using extra space
Rearrange a binary string as alternate x and y occurrences
Remove recurring digits in a given number
Find the most frequent digit without using array/string
Spacing :
Remove spaces from a given stringMove spaces to front of string in single traversalPut spaces between words starting with capital lettersRemoving spaces from a string using StringstreamRemove extra spaces from a stringURLify a given string (Replace spaces is %20)String containing first letter of every word in a given string with spacesPrint all possible strings that can be made by placing spacesPrint all possible strings that can be made by placing spaces
Remove spaces from a given string
Move spaces to front of string in single traversal
Put spaces between words starting with capital letters
Removing spaces from a string using Stringstream
Remove extra spaces from a string
URLify a given string (Replace spaces is %20)
String containing first letter of every word in a given string with spaces
Print all possible strings that can be made by placing spaces
Print all possible strings that can be made by placing spaces
Anagram :
Check whether two strings are anagram of each otherGiven a sequence of words, print all anagrams together | Set 2Anagram Substring SearchPrint all pairs of anagrams in a given array of stringsRemove minimum number of characters so that two strings become anagramCheck if two strings are k-anagrams or notCheck if binary representations of two numbers are anagramGiven a sequence of words, print all anagrams together using STLCheck if all levels of two trees are anagrams or notCount of total anagram substringsMinimum Number of Manipulations required to make two Strings Anagram Without Deletion of Character
Check whether two strings are anagram of each other
Given a sequence of words, print all anagrams together | Set 2
Anagram Substring Search
Print all pairs of anagrams in a given array of strings
Remove minimum number of characters so that two strings become anagram
Check if two strings are k-anagrams or not
Check if binary representations of two numbers are anagram
Given a sequence of words, print all anagrams together using STL
Check if all levels of two trees are anagrams or not
Count of total anagram substrings
Minimum Number of Manipulations required to make two Strings Anagram Without Deletion of Character
More >>
Palindrome :
C Program to Check if a Given String is PalindromeCheck if a given string is a rotation of a palindromeC++ Program to print all palindromes in a given rangeCheck if characters of a given string can be rearranged to form a palindromeDynamic Programming | Set 28 (Minimum insertions to form a palindrome)Longest Palindromic Substring | Set 2Find all palindromic sub-strings of a given stringOnline algorithm for checking palindrome in a streamGiven a string, print all possible palindromic partitionsPrint all palindromic partitions of a stringDynamic Programming | Set 17 (Palindrome Partitioning)Count All Palindromic Subsequence in a given StringMinimum characters to be added at front to make string palindromePalindrome Substring QueriesSuffix Tree Application 6 – Longest Palindromic SubstringPalindrome pair in an array of words (or strings)Make largest palindrome by changing at most K-digitsLexicographically first palindromic stringRecursive function to check if a string is palindromeMinimum number of Appends needed to make a string palindromeLongest Non-palindromic substringMinimum number of deletions to make a string palindromeMinimum steps to delete a string after repeated deletion of palindrome substringsCount of Palindromic substrings in an Index rangeMinimum insertions to form a palindrome with permutations allowedNth Even length Palindrome
C Program to Check if a Given String is Palindrome
Check if a given string is a rotation of a palindrome
C++ Program to print all palindromes in a given range
Check if characters of a given string can be rearranged to form a palindrome
Dynamic Programming | Set 28 (Minimum insertions to form a palindrome)
Longest Palindromic Substring | Set 2
Find all palindromic sub-strings of a given string
Online algorithm for checking palindrome in a stream
Given a string, print all possible palindromic partitions
Print all palindromic partitions of a string
Dynamic Programming | Set 17 (Palindrome Partitioning)
Count All Palindromic Subsequence in a given String
Minimum characters to be added at front to make string palindrome
Palindrome Substring Queries
Suffix Tree Application 6 – Longest Palindromic Substring
Palindrome pair in an array of words (or strings)
Make largest palindrome by changing at most K-digits
Lexicographically first palindromic string
Recursive function to check if a string is palindrome
Minimum number of Appends needed to make a string palindrome
Longest Non-palindromic substring
Minimum number of deletions to make a string palindrome
Minimum steps to delete a string after repeated deletion of palindrome substrings
Count of Palindromic substrings in an Index range
Minimum insertions to form a palindrome with permutations allowed
Nth Even length Palindrome
More >>
Binary String :
Count of operations to make a binary string”ab” freeChange if all bits can be made same by single flipLength of Longest sub-string that can be removedNumber of flips to make binary string alternate1’s and 2’s complement of a Binary NumberEfficient method for 2’s complement of a binary stringCount binary strings with k times appearing adjacent two set bitsCount strings with consecutive 1’sGenerate all binary strings from given patternAdd two bit stringsCount number of binary strings without consecutive 1’sGenerate all binary permutations such that there are more or equal 1’s than 0’s before every point in all permutationsCheck if a string follows a^nb^n pattern or notBinary representation of next numberBinary representation of next greater number with same number of 1’s and 0’sMaximum difference of zeros and ones in binary stringCheck if a binary string has a 0 between 1s or not | Set 2Min flips of continuous characters to make all characters same in a stringConcatenation of two strings in PHPProgram to add two binary stringsConvert String into Binary SequenceGenerate all binary strings without consecutive 1’sMinimum number of characters to be removed to make a binary string alternateCheck divisibility of binary string by 2^kRemoving elements between the two zerosFind i’th Index character in a binary string obtained after n iterationsNumber of substrings with odd decimal value in a binary stringGenerate n-bit Gray CodesPrint N-bit binary numbers having more 1’s than 0’s in all prefixesAdd n binary strings
Count of operations to make a binary string”ab” free
Change if all bits can be made same by single flip
Length of Longest sub-string that can be removed
Number of flips to make binary string alternate
1’s and 2’s complement of a Binary Number
Efficient method for 2’s complement of a binary string
Count binary strings with k times appearing adjacent two set bits
Count strings with consecutive 1’s
Generate all binary strings from given pattern
Add two bit strings
Count number of binary strings without consecutive 1’s
Generate all binary permutations such that there are more or equal 1’s than 0’s before every point in all permutations
Check if a string follows a^nb^n pattern or not
Binary representation of next number
Binary representation of next greater number with same number of 1’s and 0’s
Maximum difference of zeros and ones in binary string
Check if a binary string has a 0 between 1s or not | Set 2
Min flips of continuous characters to make all characters same in a string
Concatenation of two strings in PHP
Program to add two binary strings
Convert String into Binary Sequence
Generate all binary strings without consecutive 1’s
Minimum number of characters to be removed to make a binary string alternate
Check divisibility of binary string by 2^k
Removing elements between the two zeros
Find i’th Index character in a binary string obtained after n iterations
Number of substrings with odd decimal value in a binary string
Generate n-bit Gray Codes
Print N-bit binary numbers having more 1’s than 0’s in all prefixes
Add n binary strings
More >>
Lexicographic pattern :
Powet Set in Lexicographic orderLexicographically n-th permutation of stringLexicographic rank of string using stlLexicographically minimum string rotation | Set 1Generating distinct subsequences of a given string in lexicographic orderLexicographically smallest string obtained after concatenating arrayLexicographical Maximum substring of stringLexicographical concatenation of all substrings of a stringConstruct lexicographically smallest palindromeLexicographically smallest string whose hamming distance from given string is exactly KLexicographically next stringLexicographically largest subsequence such that every character occurs at least k timesLexicographically first alternate vowel and consonant stringFind a string in lexicographic order which is in between given two stringsPrint all permutations in sorted (lexicographic) orderHow to find Lexicographically previous permutation?Find n-th lexicographically permutation of a string | Set 2Lexicographic rank of a string
Powet Set in Lexicographic order
Lexicographically n-th permutation of string
Lexicographic rank of string using stl
Lexicographically minimum string rotation | Set 1
Generating distinct subsequences of a given string in lexicographic order
Lexicographically smallest string obtained after concatenating array
Lexicographical Maximum substring of string
Lexicographical concatenation of all substrings of a string
Construct lexicographically smallest palindrome
Lexicographically smallest string whose hamming distance from given string is exactly K
Lexicographically next string
Lexicographically largest subsequence such that every character occurs at least k times
Lexicographically first alternate vowel and consonant string
Find a string in lexicographic order which is in between given two strings
Print all permutations in sorted (lexicographic) order
How to find Lexicographically previous permutation?
Find n-th lexicographically permutation of a string | Set 2
Lexicographic rank of a string
Pattern Searching :
Searching for Patterns | Set 5 (Finite Automata)Pattern Searching | Set 7 (Boyer Moore Algorithm – Bad Character Heuristic)Manacher’s Algorithm – Linear Time Longest Palindromic Substring – Part 4Z algorithmSearch a Word in a 2D Grid of charactersPrinting string in plus ‘+’ pattern in the matrixWildcard Pattern MatchingDynamic Programming | Wildcard Pattern Matching | Linear Time and Constant SpaceReplace a character c1 with c2 and c2 with c1 in a string SAho-Corasick AlgorithmCount of occurrences of a “1(0+)1” pattern in a stringFind all the patterns of “1(0+)1” in a given string | SET 2In-place replace multiple occurrences of a patternFind all strings that match specific pattern in a dictionaryCheck if string follows order of characters defined by a pattern or notFind nth term of the Dragon Curve SequenceCount of number of given string in 2D character array
Searching for Patterns | Set 5 (Finite Automata)
Pattern Searching | Set 7 (Boyer Moore Algorithm – Bad Character Heuristic)
Manacher’s Algorithm – Linear Time Longest Palindromic Substring – Part 4
Z algorithm
Search a Word in a 2D Grid of characters
Printing string in plus ‘+’ pattern in the matrix
Wildcard Pattern Matching
Dynamic Programming | Wildcard Pattern Matching | Linear Time and Constant Space
Replace a character c1 with c2 and c2 with c1 in a string S
Aho-Corasick Algorithm
Count of occurrences of a “1(0+)1” pattern in a string
Find all the patterns of “1(0+)1” in a given string | SET 2
In-place replace multiple occurrences of a pattern
Find all strings that match specific pattern in a dictionary
Check if string follows order of characters defined by a pattern or not
Find nth term of the Dragon Curve Sequence
Count of number of given string in 2D character array
More >>
Split String :
Tokenizing a string in C++Split a sentence into words in C++How to split a string in C/C++, Python and Java?Check if given string can be split into four distinct stringsSplit numeric, alphabetic and special symbols from a StringSplitting a Numeric StringWays to split string such that each partition starts with distinct characterPartition a number into two divisble partsPartition given string in such manner that i’th substring is sum of (i-1)’th and (i-2)’th substringBreaking a number such that first part is integral division of second by a power of 10Divide a string in N equal partsMinimum Word BreakWord Break ProblemWord Break Problem using Backtracking
Tokenizing a string in C++
Split a sentence into words in C++
How to split a string in C/C++, Python and Java?
Check if given string can be split into four distinct strings
Split numeric, alphabetic and special symbols from a String
Splitting a Numeric String
Ways to split string such that each partition starts with distinct character
Partition a number into two divisble parts
Partition given string in such manner that i’th substring is sum of (i-1)’th and (i-2)’th substring
Breaking a number such that first part is integral division of second by a power of 10
Divide a string in N equal parts
Minimum Word Break
Word Break Problem
Word Break Problem using Backtracking
Balance Parentheses & Bracket Evaluation :
Identify and mark unmatched parenthesis in an expressionCost to Balance the parenthesesCheck for balanced parentheses in an expression | O(1) spaceCheck for balanced parentheses in an expressionLength of Longest Balanced SubsequenceBalanced expression with replacementEvaluate a boolean expression represented as stringFind maximum depth of nested parenthesis in a stringPrint all ways to break a string in bracket formFind an equal point in a string of bracketsMinimum Swaps for Bracket BalancingCheck if two expressions with brackets are sameExpression contains redundant bracket or notRange Queries for Longest Correct Bracket SubsequenceEvaluate an array expression with numbers, + and –Print Bracket NumberFind index of closing bracket for a given opening bracket in an expressionBinary tree to string with bracketsConstruct Binary Tree from String with bracket representationMinimum number of bracket reversals needed to make an expression balanced
Identify and mark unmatched parenthesis in an expression
Cost to Balance the parentheses
Check for balanced parentheses in an expression | O(1) space
Check for balanced parentheses in an expression
Length of Longest Balanced Subsequence
Balanced expression with replacement
Evaluate a boolean expression represented as string
Find maximum depth of nested parenthesis in a string
Print all ways to break a string in bracket form
Find an equal point in a string of brackets
Minimum Swaps for Bracket Balancing
Check if two expressions with brackets are same
Expression contains redundant bracket or not
Range Queries for Longest Correct Bracket Subsequence
Evaluate an array expression with numbers, + and –
Print Bracket Number
Find index of closing bracket for a given opening bracket in an expression
Binary tree to string with brackets
Construct Binary Tree from String with bracket representation
Minimum number of bracket reversals needed to make an expression balanced
Conversion :
Convert all substrings of length ‘k’ from base ‘b’ to decimalConvert Binary fraction to DecimalConvert decimal fraction to binary numberConvert a sentence into its equivalent mobile numeric keypad sequenceCheck if it is possible to convert one string into another with given constraintsConverting one string to other using append and delete last operationsConverting Decimal Number lying between 1 to 3999 to Roman NumeralsConverting Roman Numerals to Decimal lying between 1 to 3999Inverting the Move to Front TransformBurrows – Wheeler Data Transform AlgorithmCheck if it is possible to transform one string to anotherTransform the stringAn in-place algorithm for String TransformationWays of transforming one string to other by removing 0 or more charactersTransform One String to Another using Minimum Number of Given OperationConvert Ternary Expression to a Binary TreePrefix to Infix ConversionPrefix to Postfix ConversionPostfix to Prefix ConversionPostfix to Infix
Convert all substrings of length ‘k’ from base ‘b’ to decimal
Convert Binary fraction to Decimal
Convert decimal fraction to binary number
Convert a sentence into its equivalent mobile numeric keypad sequence
Check if it is possible to convert one string into another with given constraints
Converting one string to other using append and delete last operations
Converting Decimal Number lying between 1 to 3999 to Roman Numerals
Converting Roman Numerals to Decimal lying between 1 to 3999
Inverting the Move to Front Transform
Burrows – Wheeler Data Transform Algorithm
Check if it is possible to transform one string to another
Transform the string
An in-place algorithm for String Transformation
Ways of transforming one string to other by removing 0 or more characters
Transform One String to Another using Minimum Number of Given Operation
Convert Ternary Expression to a Binary Tree
Prefix to Infix Conversion
Prefix to Postfix Conversion
Postfix to Prefix Conversion
Postfix to Infix
Misc :
Word Wrap problem ( Space optimized solution )Form minimum number from given sequenceMaximum number of characters between any two same character in a stringPrint shortest path to print a string on screenMinimum number of stops from given pathCheck whether second string can be formed from characters of first stringMirror characters of a stringFind words which are greater than given length kFind last index of a character in a stringFind position of the given number among the numbers made of 4 and 7Find winner of an election where votes are represented as candidate namesCompare Version Numbers with large inputs allowedPossibility of moving out of mazePossibility of a word from a given set of charactersFind the arrangement of queue at given timeProgram to generate all possible valid IP addresses from given stringProgram to validate an IP addressProgram to check for a Valid IMEI NumberDecode a median string to the original stringDecode a string recursively encoded as count followed by substringMinimal operations to make a number magicalProgram to check for ISBNProgram for credit card number validationMaximize a number considering permutations with values smaller than limitFind if a string starts and ends with another given string
Word Wrap problem ( Space optimized solution )
Form minimum number from given sequence
Maximum number of characters between any two same character in a string
Print shortest path to print a string on screen
Minimum number of stops from given path
Check whether second string can be formed from characters of first string
Mirror characters of a string
Find words which are greater than given length k
Find last index of a character in a string
Find position of the given number among the numbers made of 4 and 7
Find winner of an election where votes are represented as candidate names
Compare Version Numbers with large inputs allowed
Possibility of moving out of maze
Possibility of a word from a given set of characters
Find the arrangement of queue at given time
Program to generate all possible valid IP addresses from given string
Program to validate an IP address
Program to check for a Valid IMEI Number
Decode a median string to the original string
Decode a string recursively encoded as count followed by substring
Minimal operations to make a number magical
Program to check for ISBN
Program for credit card number validation
Maximize a number considering permutations with values smaller than limit
Find if a string starts and ends with another given string
More >>
Quick Links :
‘Practice Problems’ on Strings
‘Quizzes’ on Strings
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.
Comments
Old Comments
Must Do Coding Questions for Product Based Companies
Microsoft Interview Experience for Internship (Via Engage)
Difference between var, let and const keywords in JavaScript
Find number of rectangles that can be formed from a given set of coordinates
Array of Objects in C++ with Examples
How to Replace Values in Column Based on Condition in Pandas?
C Program to read contents of Whole File
How to Replace Values in a List in Python?
How to Read Text Files with Pandas?
Infosys DSE Interview Experience | On-Campus 2021