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<cmath>#include<cstdio>#include<iostream>#include<string>usingnamespacestd;intmain(){// Assign strings a and bstringa;stringb;// Get the inputgetline(cin,a);getline(cin,b);// Find the lengthintlen1=a.size();intlen2=b.size();// Output length and concatenationcout<<len1<<" "<<len2<<endl;cout<<a+b<<endl;// Work on swapping the characterschartempChar=a[0];a[0]=b[0];b[0]=tempChar;// Output swapped characterscout<<a<<" "<<b;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 is my code, bit simple, easy to understand.