Skip to content

Tag Archives: CPP Strings Programs

CPP Strings Programs

Printing string literals and QString with QDebug in C++ can be a useful tool for debugging. By printing out the contents of a string or… Read More
Splitting a string by some delimiter is a very common task. For example, we have a comma-separated list of items from a file and we… Read More
Given a string str, find the length of the longest substring without repeating characters.  For “ABDEFGABEF”, the longest substring are “BDEFGA” and “DEFGAB”, with length… Read More
Given a string of lowercase characters from ‘a’ – ‘z’. We need to write a program to print the characters of this string in sorted… Read More
Given two binary strings, return their sum (also a binary string).Example: Input: a = "11", b = "1" Output: "100" We strongly recommend you to… Read More
Given a string, reverse it using stack. For example “GeeksQuiz” should be converted to “ziuQskeeG”. Following is simple algorithm to reverse a string using stack. … Read More
Given a string S, c1 and c2. Replace character c1 with c2 and c2 with c1. Examples: Input: grrksfoegrrks, c1 = e, c2 = r Output:… Read More
String str is given which contains lowercase English letters and spaces. It may contain multiple spaces. Get the first letter of every word and return… Read More
Write a recursive function to print the reverse of a given string. Code:  C++ // C++ program to reverse a string using recursion  #include <bits/stdc++.h> using… Read More
In this article, we learn how we can convert float to string in C++ using different methods:  Using the to_string() Using stringstream Using Macros Using… Read More
Given a string of operations containing three operands for each operation “type of command“, “first operand“, and “second operand“. Calculate all the commands given in… Read More
Given a string of digits, remove leading zeros from it. Examples: Input : 00000123569 Output : 123569 Input : 000012356090 Output : 12356090 Recommended: Please… Read More

Start Your Coding Journey Now!