Tag Archives: substring

Given a string str consisting of lowercase characters, the task is to modify the string such that it does not contain any palindromic substring of… Read More
Given a string S of length N, the task is to find the smallest balanced substring in S. If no such substring is present, print… Read More
Given a string S and a string T, the task is to find the minimum possible length to which the string S can be reduced… Read More
Prerequisites: Z-algorithm Given a string S, the task is to find the maximum number of palindromes that can be formed after performing the given steps:… Read More
Given a string S of length N consisting of characters “(“ and “)” only, the task is to convert the given string into a balanced… Read More
Given a binary string str, the task is to find the count of ways to partition the string such that each partitioned substring contains exactly… Read More
Given a string str, the task is to count non-empty substrings with equal number of ‘a’, ‘b’, ‘c’, and ‘d’. Examples: Input: str = “abcdef” Output:… Read More
Given three strings str, str1 and str2, the task is to count the number of pairs of occurrences of str1 and str2 as a substring… Read More
Given a string str, the task is to extract the substrings present between two delimiters, i.e. ‘[‘ and ‘]’. Examples: Input: str = “[This is… Read More
Given a valid parenthesis string str consisting of lowercase alphabets, opening, and closing brackets, the task is to find the string by removing the outermost… Read More
Given an alphanumeric string S of length N, the task is to sort the string in increasing order of their priority based on the following… Read More
Given a numeric string S, the task is to find the longest non-empty substring that can be made palindrome. Examples: Input: S = “3242415”Output: 5Explanation:… Read More
Given a string S of length N, the task is to check if a string can be split into two substrings, say A and B… Read More
Given two strings S and T of length N and M respectively, the task is to check if the string S can be converted to… Read More
Given a binary string S, the task is to convert the given string S to its lexicographic maximum form by reversing substrings having an even… Read More