# Category Archives: Strings

Questions related to strings

## Form the largest palindromic number using atmost two swaps

Given a non-negative palindromic number num containing n number of digits. The problem is to apply at most two swap operations on the number num… Read More »

## Program to count vowels, consonant, digits and special characters in string.

Given a string and the task is to count vowels, consonant, digits and special character in string. Special character also contains the white space. Examples:… Read More »

## Next word that does not contain a palindrome and has characters from first k

Given a string and a limit k, find lexicographically next word which contains characters from a set of first K letters of the English alphabet… Read More »

## Check whether second string can be formed from characters of first string

Given two strings str1 and str2, check if str2 can be formed from str1 Example : Input : str1 = geekforgeeks, str2 = geeks Output… Read More »

## Print number of words, vowels and frequency of each character

Given a string str with uppercase, lowercase and special characters. The input string is to end with either a space or a dot. The problem… Read More »

## Map function and Dictionary in Python to sum ASCII values

We are given a sentence of english language(can also contain digits), we need to compute and print the sum of ASCII values of characters of… Read More »

## Map function and Lambda expression in Python to replace characters

Given a string S, c1 and c2. Replace character c1 with c2 and c2 with c1. Examples: Input : str = ‘grrksfoegrrks’ c1 = e,… Read More »

## Zip function in Python to change to a new character set

Given a 26 letter character set, which is equivalent to character set of English alphabet i.e. (abcd….xyz) and act as a relation. We are also… Read More »

## Encrypt string with product of number of vowels and consonants in substring of size k

Given a string s and a positive integer k. You need to encrypt the given string such that each substring of size k is represent… Read More »

## Program to check if a number belongs to a particular base or not

Given a number N and its radix base R, find whether its valid or not according to its radix base. Find valid/invalid number for any… Read More »

## SequenceMatcher in Python for Longest Common Substring

Given two strings ‘X’ and ‘Y’, print the longest common sub-string. Examples: Input : X = “GeeksforGeeks”, Y = “GeeksQuiz” Output : Geeks Input :… Read More »

## Position of robot after given movements

Given a robot which can only move in four directions, UP(U), DOWN(D), LEFT(L), RIGHT(R). Given a string consisting of instructions to move. Output the co-ordinates… Read More »

## Breaking a number such that first part is integral division of second by a power of 10

Given a very large number N, we need to count the total ways such that if we divide the number into two parts a and… Read More »

## Number of ways to insert a character to increase the LCS by one

Given two strings A and B. The task is to count the number of ways to insert a character in string A to increase the… Read More »

## Program to implement ASCII lookup table

ASCII stands for American Standard Code for Information Interchange. Computers can only understand numbers, so an ASCII code is the numerical representation of a character… Read More »