Program to Toggle all Characters in a String

Problem Statement In the “Program to Toggle all Characters in a String” problem we have given a string, write a program to toggle all characters of the given string. Here toggle means converting all the uppercase characters to lowercase and all lowercase characters to uppercase characters. Input Format The first …

Read moreProgram to Toggle all Characters in a String

Check length of a String is Equal to the Number Appended at its Last

Problem Statement In the “Check length of a string is Equal to the Number Appended at its Last” problem we have given a string that is appended with a number at last. Write a program that checks whether the length of the string excluding the number is the same as …

Read moreCheck length of a String is Equal to the Number Appended at its Last

Generate all Binary Strings Without Consecutive 1’s

Problem Statement In the “Generate all binary strings without consecutive 1’s” problem we have given an integer k, write a program to print all binary strings of size k with no consecutive 1’s. Input Format The first and only one line containing an integer N. Output Format Print all possible …

Read moreGenerate all Binary Strings Without Consecutive 1’s

Sort a String According to Another String

Problem Statement Given two input strings, a pattern and a string. We need to sort the string according to the order defined by the pattern. Pattern string has no duplicates and it has all characters of the string. Input Format The first line containing a string s which we need …

Read moreSort a String According to Another String

Smallest Palindrome after Replacement

Problem Statement In the “Smallest Palindrome after Replacement” problem we have given the input string contains lower case alphabets characters and dots(.). We need to replace all dots with some alphabet character in such a way that the resultant string becomes a palindrome. The palindrome should be lexicographically smallest. Input …

Read moreSmallest Palindrome after Replacement

Minimum Characters to be Removed to Make a Binary String Alternate

Problem Statement Given a binary string, write a program that will find the minimum number of characters that can be removed from this string so that it becomes alternate. A binary string is said to be alternate if there are no consecutive 0’s or 1’s Input Format The first line …

Read moreMinimum Characters to be Removed to Make a Binary String Alternate