StringStream in C++ for Decimal to Hexadecimal and back
Stringstream is stream class present in C++ which is used for doing operations on a string. It can be used for formatting/parsing/converting a string to number/char etc. Hex is an I/O manipulator that takes reference to an I/O stream as parameter and returns reference to the stream after manipulation. Here is a quick way to convert any decimal to hexadecimal using stringstream:...
read more
C++ Program to Check String is Containing Only Digits
Prerequisite: Strings in C++...
read more
Different ways to copy a string in C/C++
Copying a string is a common operation in C/C++ used to create a duplicate copy of the original string. In this article, we will see how to copy strings in C/C++....
read more
Reverse individual words
Given string str, we need to print the reverse of individual words....
read more
How to Replace Text in a String Using Regex in C++?
Regular expressions or what we can call regex for short are sequences of symbols and characters that create a search pattern and help us to find specific patterns within a given text. In this article, we will learn how to replace text in a string using regex in C++....
read more
Modify array of strings by replacing characters repeating in the same or remaining strings
Given an array of strings arr[] consisting of lowercase and uppercase characters only, the task is to modify the array by removing the characters from the strings which are repeating in the same string or any other string. Print the modified array....
read more
Find the winner of game of repeatedly removing the first character to empty given string
Given a positive integer N, representing the count of players playing the game and an array of strings arr[], consisting of the numeric strings made up of digits from the range [‘1’, ‘N’]. Considering ith player is assigned with the string arr[i], the task is to find the winner of the game when all N players play the game optimally as per the following rules:...
read more
Print all strings from given array that can be typed using keys from a single row of a QWERTY keyboard
Given an array of strings arr[], consisting of strings made up of lowercase and uppercase letters, the task is to print all the strings from the given array that can be typed using keys from a single row of a QWERTY keyboard....
read more
Sub-string that contains all lowercase alphabets after performing the given operation
Given a string str containing lower case alphabets and character ‘?’. The task is to check if it is possible to make str good or not.A string is called good if it contains a sub-string of length 26 which has every character of lower case alphabets in it. The task is to check if it is possible to make the string good by replacing ‘?’ characters with any lower case alphabet. If it is possible then print the modified string otherwise print -1....
read more
Check if expression contains redundant bracket or not | Set 2
Given a string of balanced expressions, find if it contains a redundant parenthesis or not. A set of parenthesis is redundant if the same sub-expression is surrounded by unnecessary or multiple brackets. Print ‘Yes’ if redundant else ‘No’.Note: Expression may contain ‘+’, ‘*‘, ‘–‘ and ‘/‘ operators. Given expression is valid and there are no white spaces present.Note: The problem is intended to solve in O(1) extra space....
read more
stringstream in C++ and its Applications
A stringstream associates a string object with a stream allowing you to read from the string as if it were a stream (like cin). To use stringstream, we need to include sstream header file. The stringstream class is extremely useful in parsing input....
read more
Program to reverse words in a given string in C++
Given a sentence in the form of string str, the task is to reverse each word of the given sentence in C++. Examples:...
read more