Please Login in order to post a comment
using namespace std;
int main() { // Complete the program string a,b; cin >> a; cin >> b;
cout << a.size() << " " << b.size() << endl; cout << a + b << endl; char temp = b[0]; b[0] = a[0]; a[0] = temp; cout << a << " " << b << endl; return 0;
}
#include <iostream> #include <string> using namespace std; int main() { // Complete the program string a, b; cin >> a; cin >> b; cout << a.size() << " " << b.size() << endl; cout << a + b << endl; char temp = b[0]; b[0] = a[0]; a[0] = temp; cout << a << " " << b << endl; return 0; }
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; int main() { string a, b, c{}; cin >> a >> b; cout << a.size() << " " << b.size() << endl; cout << a + b << endl; for (double i = a.size(); i <= a.size(); ++i) { char temp = a[0]; a[0] = b[0]; b[0] = temp; cout << a << string(1, ' ') << b; } return 0; }
#include <iostream> #include <string> using namespace std; int main() { string kata1,kata2; string jumlah; getline(cin,kata1); getline(cin,kata2); cout << kata1 << endl; cout << kata2 << endl; int panjang1 = kata1.size(); int panjang2 = kata2.size(); cout << panjang1 << " " << panjang2 << endl; // cout << panjang2 << endl; // kata1.append(kata2); jumlah = kata1 + kata2; cout << jumlah << endl; why test case failed link https://www.hackerrank.com/challenges/c-tutorial-strings kata1[0] = kata2[0]; kata2[0] = kata1[0]; cout << kata1 << " " << kata2 << endl;
return 0;
int main() { // Complete the program string letras_a; string letras_b; cin >> letras_a; cin >> letras_b; cout << letras_a.size() <<" "; cout << letras_b.size() << endl; cout << letras_a + letras_b << endl; cout << letras_b[0]; for(int i = 1;i<letras_a.size();i++){ cout << letras_a[i]; } cout << " " << letras_a[0]; for(int i = 1;i<letras_b.size();i++){ cout << letras_b[i]; } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
include
include
using namespace std;
int main() { // Complete the program string a,b; cin >> a; cin >> b;
}
}