Strings

70 programs in this topic — each includes source code, sample output and explanation.

  1. Find Length of String

    This program finds the length of a string.

  2. Concatenate Two Strings

    This program concatenates two strings.

  3. Compare Two Strings

    This program compares two strings for equality.

  4. Check Palindrome String

    This program checks if a string is palindrome.

  5. Case Insensitive Palindrome Check

    This program checks palindrome ignoring case.

  6. Extract Substring

    This program extracts substring from a string.

  7. Search Substring in String

    This program searches for substring in string.

  8. Regex Pattern Matching

    This program matches string with regex pattern.

  9. Remove Digits from String

    This program removes digits from a string using regex.

  10. Validate Email Address

    This program validates email address using regex.

  11. Reverse Words in String

    This program reverses words in a string.

  12. Reverse Characters in String

    This program reverses characters of a string.

  13. Check Anagram Strings

    This program checks if two strings are anagrams.

  14. Case Insensitive Anagram Check

    This program checks anagrams ignoring case.

  15. Longest Substring Without Repeating Characters

    This program finds longest substring without repeating characters.

  16. Longest Palindromic Substring

    This program finds longest palindromic substring.

  17. Split String by Digits

    This program splits string by digits using regex.

  18. Find All Digits in String

    This program finds all digits in a string using regex.

  19. Count Words Using Regex

    This program counts words in a string using regex.

  20. Validate Phone Number

    This program validates phone number using regex.

  21. Find Longest Common Prefix

    This program finds longest common prefix among strings.

  22. Check String Rotation

    This program checks if one string is rotation of another.

  23. Count Substring Occurrences

    This program counts occurrences of substring in string.

  24. Most Frequent Substring of Length K

    This program finds most frequent substring of length K.

  25. Replace Multiple Spaces with Single Space

    This program replaces multiple spaces with single space.

  26. Replace Vowels with *

    This program replaces vowels with *.

  27. Left Rotate String

    This program performs left rotation of string.

  28. Right Rotate String

    This program performs right rotation of a string.

  29. Character Frequency in String

    This program counts frequency of each character in a string.

  30. Replace Non Alphabetic Characters

    This program removes non alphabetic characters from string using regex.

  31. Generate All Permutations of String

    This program generates all permutations of a string.

  32. Find Longest Common Subsequence

    This program finds longest common subsequence between two strings.

  33. Check Unique Characters in Substring

    This program checks if substring has unique characters.

  34. Longest Unique Substring

    This program finds longest substring with unique characters.

  35. Validate Password Strength

    This program validates password strength using regex.

  36. Validate URL Format

    This program validates URL format using regex.

  37. Check if Two Strings are Permutations

    This program checks if two strings are permutations of each other.

  38. Print Longest Common Subsequence

    This program prints the longest common subsequence between two strings.

  39. Unique Substring Count

    This program counts unique substrings in a string.

  40. Validate Date Format

    This program validates date format using regex.

  41. Generate Permutations without Repetition

    This program generates permutations of a string without repeating characters.

  42. Substring Search using KMP

    This program searches substring using KMP algorithm.

  43. Substring Search using Rabin Karp

    This program searches substring using Rabin Karp algorithm.

  44. Filter Only Alphabets

    This program filters only alphabets from string.

  45. Filter Only Digits

    This program filters only digits from string.

  46. Find Longest Repeating Subsequence

    This program finds longest repeating subsequence.

  47. Permutations with Fixed Character Position

    This program generates permutations of a string with one character fixed at a position.

  48. Pattern Search using KMP

    This program searches for pattern using KMP algorithm.

  49. Pattern Search using Rabin Karp

    This program searches for pattern using Rabin Karp algorithm.

  50. Print Longest Repeating Subsequence

    This program prints longest repeating subsequence.

  51. Basic String Compression

    This program compresses string by counting consecutive characters.

  52. Remove Consecutive Duplicates

    This program removes consecutive duplicate characters.

  53. Rotate String Only if Palindrome

    This program rotates string only if it is palindrome.

  54. Rotate String Only if Length Even

    This program rotates string only if length is even.

  55. Extract Email from Text

    This program extracts email address from text using regex.

  56. Extract Numbers from Text

    This program extracts numbers from text using regex.

  57. Longest Palindromic Subsequence

    This program finds longest palindromic subsequence using DP.

  58. Longest Common Substring

    This program finds longest common substring using dynamic programming.

  59. Extract Hashtags from Text

    This program extracts hashtags from text using regex.

  60. Longest Repeating Substring

    This program finds longest repeating substring using DP.

  61. Match String with Wildcard Pattern

    This program checks if a string matches a wildcard pattern.

  62. Validate IP Address

    This program validates IPv4 address using regex.

  63. Validate Hex Color Code

    This program validates hex color code using regex.

  64. Check Concatenation of Substrings

    This program checks if string is concatenation of given substrings.

  65. Find Substring Concatenation Indices

    This program finds indices where concatenation of words occurs.

  66. Calculate Edit Distance

    This program calculates edit distance between two strings.

  67. Print Edit Operations

    This program prints edit operations to convert one string into another.

  68. Wildcard Matching with ? and *

    This program matches string with advanced wildcard pattern.

  69. Validate Strong Username

    This program validates username using regex.

  70. Minimum Insertions to Make Palindrome

    This program finds minimum insertions to make string palindrome.

Quick Links to Explore