Given a string s, the task is to print all permutations of a string that are in ascending order, i.e., their characters are in ascending order. Examples: Input: Cplusplus Output: Cllppssuu Out ...read more
Strings
16 postsGiven a string S of size N, the task is to sort the string without changing the place of vowels. Examples: Input: S = "example" Output: elampxe Explanation: The consonants are xmpl. ...read more
Given a binary string consisting of ‘0’ & ‘1’. You can remove any subsequence in given string but can’t pick adjacent indices. Print “POSSIBLE” if string can be sorted else print “NOTPOSSIBLE”. ...read more
You are given n strings. You have to print them in lexicographical increasing order. Also, ensure that all of the strings should be distinct. Examples: Input: {"Aarav", "Arjun", "Rahul", "Rishabh", "Kunal"} Output: ...read more
Given an array arr[] of N dates in the form of “dd-mm-yyyy”, the task is to sort these dates in ascending order. Examples: Input: arr[] = { "25-08-1996", "03-08-1970", "09-04-1994" } Output: ...read more
Given an array arr[] of N strings, the task is to sort these strings according to the numbers of matches required to represent them. Examples: Input: arr[] = { "123", "46", "8", ...read more
You are given two strings string1 and string2. Your task is to find length of longest consecutive occurrences of second string that occurs in first string. Examples: Input: string1="AAACBBAAAA", string2="A" Output: 4 ...read more
Given a string S, the task is to sort odd indices in ascending order and even indices in descending order of the string. Examples: Input: S = "Cplusplus" Output: Cululspsp Explanation: Sort ...read more
You are given a string s consisting only of characters ‘a’ and ‘b’. You can delete any number of characters in s to make s balanced. s is balanced if there is ...read more
Given two strings string1 and string2, the task is to find the smallest substring in string1 containing all characters of string2. Examples : Input: string = “Cplusplus is the best”, pattern = ...read more