HackerRank C++ Strings

In this Problem we have to take input two strings and print length of strings,Concatenation of string and also reverse order of strings

  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. int main()
  5. {
  6. string a,b;
  7. cin>>a;
  8. cin>>b;
  9. int len1 = a.size();
  10. int len2 = b.size();
  11. cout<<len1<<" "<<len2<<endl;
  12. cout<<a<<b<<endl;
  13. char c;
  14. c=a[0];
  15. a[0]=b[0];
  16. b[0]=c;
  17. cout<<a<<" "<<b;
  18. return 0;
  19. }
Please click on the like button if it worked

Solution not working or have any suggestions? Please send an email to [email protected]

donate a cup of tea :)

Join Our Facebook Group

Share this solution


Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube