58 lines
653 B
C++
Raw Normal View History

2021-02-19 12:06:26 -05:00
/*
* input is:
*
* firstName middleName lastName
*
* output is:
*
* lastName, firstInitial.middleInitial.
*
* Ex:
*
* input:
* Pat Silly Doe
*
* output:
*
* Doe, P.S.
*/
#include <iostream>
#include <string>
using namespace std;
int main() {
/* Type your code here. */
string f, m, l, s;
//getline(cin, s);
cin >> f;
cin >> m;
cin >> l;
if(l.size() != 0){
cout << l << ", " << f.at(0) << "." << m.at(0) << ".\n";
}
else{
cout << m << ", " << f.at(0) << ".\n";
}
/*
if(true){
cout << l << ", " << f.at(0) << "." << l.at(0) << ".\n";
}
else{
cout << l << ", " << f.at(0) << ".\n";
}
*/
return 0;
}