Concatenation of two strings

Given a two strings, this function will concatenate the two strings into one string. Example INPUT s1= cat s2 = dog OUTPUT catdog In the above example, the two strings cat and dog are concatenated Time Complexity: O(n), where n is the size of the largest string Algorthm1 1. Create …

Read more

Reverse a String

Reverse the given string. Example Method 1 Algorithm Use inbuilt STL functions. (Standard library functions) Reverse(position 1, position 2)  → Reverses from position 1 to position 2 Let string be S Call function like this: reverse(S.begin(), S.end()) Print S, it will be reversed. C++ Program #include <bits/stdc++.h> using namespace std; int …

Read more

Most repeating character in a string

In the given string find the maximum occurring character Maximum occurring character: character which is coming more number of times. (Case sensitivity is present, “D” and “d” are not the same.) Note: If there are more than one character repeated more than once then it prints the first most repeated …

Read more

Translate »