Please Login in order to post a comment
int main() { string a, b; cin >> a >> b; cout << a.length() << " " << b.length() << endl; cout << a + b << endl; string a_(a), b_(b); a_[0] = b[0]; b_[0] = a[0]; cout << a_ << " " << b_ << endl; return 0; }
#include <iostream> #include <string> using namespace std; int main() { string a,b; cin>>a; cin>>b; cout<<a.length()<<" "<<b.length()<<endl; cout<<(a+b)<<endl; char temp; temp=a[0]; a[0]=b[0]; b[0]=temp; cout<<a<<" "<<b; return 0;
}
Here is Strings problem solution in C++ - https://programmingoneonone.com/hackerrank-strings-solution-in-cpp.html
int main() { // Complete the program string a , b , c; cin>>a>>b; cout<<a.length()<<" "<<b.length()<<endl; cout<<(a+b)<<endl; cout<<(b.substr(0,1)+a.substr(1,a.length()))<<" "<<(a.substr(0,1)+b.substr(1,b.length())); return 0; }
Great for beginners looking to grasp C++ string manipulation efficiently! betbricks 7
Seems like cookies are disabled on this browser, please enable them to open this website
}
Here is Strings problem solution in C++ - https://programmingoneonone.com/hackerrank-strings-solution-in-cpp.html
Great for beginners looking to grasp C++ string manipulation efficiently! betbricks 7