Basically, my goal for the struggling part is to swap the first letters of each string and print it. Everything seems to work except my code will not print B. I realize I need to store A[0] into a temp variable so it is not overwritten before being stored in B[0]. For some reason when I run my code (in the sites compiler), it will just print "ebcd". It never prints B even though I am telling it to.
#include <iostream>
#include <string>
#include <bits/stdc++.h>
using namespace std;
void wordSize(string a, string b){
    int lenA = a.size();
    int lenB = b.size();
    cout << lenA << " " << lenB << endl;
}
void firstLetterSwap(string a, string b){
    int sizeA = a.size();
    int sizeB = b.size();
    char temp;
    char* A = new char[sizeA];
    char* B = new char[sizeB];
    strcpy(A, a.c_str());
    strcpy(B, b.c_str());
    A[0] = temp;
    A[0] = B[0];
    B[0] = temp;
    cout << A << " " << B << endl;
}
int main() {
    string a, b;
    cin >> a; 
    cin >> b;
    wordSize(a, b);
    cout << a + b << endl;
    firstLetterSwap(a, b);
    return 0;
}
 
     
     
     
    