Problem link for strings
Code :
#include<iostream>
#include<string>
using namespace std;
int main(){
string a, b;
cin>>a>>b;
int len_a, len_b;
len_a = a.size();
len_b = b.size();
cout<<len_a<<" "<<len_b<<endl;
string c;
c = a+b;
cout<<c<<endl;
char temp;
// now swapping first character of the strings
temp = a[0];
a[0] = b[0];
b[0] = temp;
cout<<a<<" "<<b<<endl;
return 0;
}
No comments:
Post a Comment