We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
#include<iostream>#include<string>#include<utility> // std::swapintmain(){std::stringa{};std::stringb{};std::cin>>a>>b;std::cout<<a.size()<<' '<<b.size()<<std::endl;std::cout<<a+b<<std::endl;// Don't forget to check if both strings are not nullif(a.size()>0&&b.size()>0){std::swap(a[0],b[0]);std::cout<<a<<' '<<b<<std::endl;}return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Strings
You are viewing a single comment's thread. Return to all comments →
Here's my answer: