C++ provides a nice alternative data type to manipulate strings, and the data type is conveniently called string. Some of its widely used features are the following:
string a = "abc";
int len = a.size();
string a = "abc";
string b = "def";
string c = a + b; // c = "abcdef".
string s = "abc";
char c0 = s[0]; // c0 = 'a'
char c1 = s[1]; // c1 = 'b'
char c2 = s[2]; // c2 = 'c'
s[0] = 'z'; // s = "zbc"
Try the following example in the editor below.
You are given two strings, A and B, separated by a new line. Each string will consist of lower case Latin characters (‘a’-‘z’).
Output three lines:
Sample input:
abcd
ef
Sample Output:
4 2
abcdef
ebcd af