Strings

Sort by

recency

|

783 Discussions

|

  • + 0 comments

    include

    include

    using namespace std;

    int main() { // Complete the program string a,b; cin>>a; cin>>b; string c=a+b; int len1 = a.size(); int len2 = b.size(); cout<< len1 << " " << len2 <

  • + 0 comments

    include

    include

    using namespace std;

    int main() { // Complete the program string a,b; cin>>a; cin>>b; string c=a+b; int len1 = a.size(); int len2 = b.size(); cout<< len1 << " " << len2 <

  • + 0 comments

    int main() { // Complete the program string a, b; cin >> a >> b;

    // print sizes
    cout << a.size() << " " << b.size() << endl;
    
    // print concatenation
    cout << a + b << endl;
    
    // swap first characters
    char temp = a[0];
    a[0] = b[0];
    b[0] = temp;
    
    // print after swap
    cout << a << " " << b << endl;
    
    return 0;
    

    }

  • + 0 comments

    Here is my code!

    #include <cmath>
    #include <cstdio>
    #include <vector>
    #include <iostream>
    #include <algorithm>
    using namespace std;
    
    
    int main() {
        string a, b;
        cin >> a >> b;
        cout << a.size() << " " << b.size() << "\n";
        cout << a + b << "\n";
        char temp = a[0];
        a[0] = b[0];
        b[0] = temp;
        cout << a << " " << b;
        return 0;
    }
    
  • + 0 comments

    HackerRank is such a solid platform for coding practice! Cricket 99 club