Strings Hackerrank Solution in C++
For Explanation Watch Video:
Sample Input
abcd
ef
Sample Output
4 2
abcdef
ebcd af
Code:
#include <iostream>#include <string>using namespace std;
int main() { // Complete the program string a,b; cin>>a>>b; cout<<a.length()<<" "<<b.length()<<endl;//4 2 cout<<a+b<<endl; swap(a[0],b[0]); cout<<a<<" "<<b; return 0;}
Comments
Post a Comment