Strings
70 programs in this topic — each includes source code, sample output and explanation.
-
Find Length of String
This program finds the length of a string.
-
Concatenate Two Strings
This program concatenates two strings.
-
Compare Two Strings
This program compares two strings for equality.
-
Check Palindrome String
This program checks if a string is palindrome.
-
Case Insensitive Palindrome Check
This program checks palindrome ignoring case.
-
Extract Substring
This program extracts substring from a string.
-
Search Substring in String
This program searches for substring in string.
-
Regex Pattern Matching
This program matches string with regex pattern.
-
Remove Digits from String
This program removes digits from a string using regex.
-
Validate Email Address
This program validates email address using regex.
-
Reverse Words in String
This program reverses words in a string.
-
Reverse Characters in String
This program reverses characters of a string.
-
Check Anagram Strings
This program checks if two strings are anagrams.
-
Case Insensitive Anagram Check
This program checks anagrams ignoring case.
-
Longest Substring Without Repeating Characters
This program finds longest substring without repeating characters.
-
Longest Palindromic Substring
This program finds longest palindromic substring.
-
Split String by Digits
This program splits string by digits using regex.
-
Find All Digits in String
This program finds all digits in a string using regex.
-
Count Words Using Regex
This program counts words in a string using regex.
-
Validate Phone Number
This program validates phone number using regex.
-
Find Longest Common Prefix
This program finds longest common prefix among strings.
-
Check String Rotation
This program checks if one string is rotation of another.
-
Count Substring Occurrences
This program counts occurrences of substring in string.
-
Most Frequent Substring of Length K
This program finds most frequent substring of length K.
-
Replace Multiple Spaces with Single Space
This program replaces multiple spaces with single space.
-
Replace Vowels with *
This program replaces vowels with *.
-
Left Rotate String
This program performs left rotation of string.
-
Right Rotate String
This program performs right rotation of a string.
-
Character Frequency in String
This program counts frequency of each character in a string.
-
Replace Non Alphabetic Characters
This program removes non alphabetic characters from string using regex.
-
Generate All Permutations of String
This program generates all permutations of a string.
-
Find Longest Common Subsequence
This program finds longest common subsequence between two strings.
-
Check Unique Characters in Substring
This program checks if substring has unique characters.
-
Longest Unique Substring
This program finds longest substring with unique characters.
-
Validate Password Strength
This program validates password strength using regex.
-
Validate URL Format
This program validates URL format using regex.
-
Check if Two Strings are Permutations
This program checks if two strings are permutations of each other.
-
Print Longest Common Subsequence
This program prints the longest common subsequence between two strings.
-
Unique Substring Count
This program counts unique substrings in a string.
-
Validate Date Format
This program validates date format using regex.
-
Generate Permutations without Repetition
This program generates permutations of a string without repeating characters.
-
Substring Search using KMP
This program searches substring using KMP algorithm.
-
Substring Search using Rabin Karp
This program searches substring using Rabin Karp algorithm.
-
Filter Only Alphabets
This program filters only alphabets from string.
-
Filter Only Digits
This program filters only digits from string.
-
Find Longest Repeating Subsequence
This program finds longest repeating subsequence.
-
Permutations with Fixed Character Position
This program generates permutations of a string with one character fixed at a position.
-
Pattern Search using KMP
This program searches for pattern using KMP algorithm.
-
Pattern Search using Rabin Karp
This program searches for pattern using Rabin Karp algorithm.
-
Print Longest Repeating Subsequence
This program prints longest repeating subsequence.
-
Basic String Compression
This program compresses string by counting consecutive characters.
-
Remove Consecutive Duplicates
This program removes consecutive duplicate characters.
-
Rotate String Only if Palindrome
This program rotates string only if it is palindrome.
-
Rotate String Only if Length Even
This program rotates string only if length is even.
-
Extract Email from Text
This program extracts email address from text using regex.
-
Extract Numbers from Text
This program extracts numbers from text using regex.
-
Longest Palindromic Subsequence
This program finds longest palindromic subsequence using DP.
-
Longest Common Substring
This program finds longest common substring using dynamic programming.
-
Extract Hashtags from Text
This program extracts hashtags from text using regex.
-
Longest Repeating Substring
This program finds longest repeating substring using DP.
-
Match String with Wildcard Pattern
This program checks if a string matches a wildcard pattern.
-
Validate IP Address
This program validates IPv4 address using regex.
-
Validate Hex Color Code
This program validates hex color code using regex.
-
Check Concatenation of Substrings
This program checks if string is concatenation of given substrings.
-
Find Substring Concatenation Indices
This program finds indices where concatenation of words occurs.
-
Calculate Edit Distance
This program calculates edit distance between two strings.
-
Print Edit Operations
This program prints edit operations to convert one string into another.
-
Wildcard Matching with ? and *
This program matches string with advanced wildcard pattern.
-
Validate Strong Username
This program validates username using regex.
-
Minimum Insertions to Make Palindrome
This program finds minimum insertions to make string palindrome.