Please Login in order to post a comment
#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
int main() { string a, b; getline(cin, a); getline(cin, b); std::cout << a.size() << " " << b.size() << std::endl; std::cout << a + b << std::endl; std::cout << b[0] + a.substr(1, a.npos) << " " << a[0] + b.substr(1, b.npos); return 0; }
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