fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef long long ll;
  5. void chuanHoa(string &a) {
  6. a[0] = toupper(a[0]);
  7. for (int i = 1; i < a.size(); i++) {
  8. a[i] = tolower(a[i]);
  9. }
  10. }
  11. void fullName(string &a) {
  12. stringstream ss(a);
  13. string res;
  14. string tmp;
  15. while (ss >> tmp) {
  16. chuanHoa(tmp);
  17. res += tmp + ' ';
  18. }
  19. a = res;
  20. }
  21.  
  22. typedef struct {
  23. string name;
  24. string d, m, y;
  25. int stt;
  26. } sv;
  27.  
  28. int main() {
  29. vector<sv> vt;
  30. int t;
  31. cin >> t;
  32. cin.ignore();
  33.  
  34. for (int i = 0; i < t; i++) {
  35. sv x;
  36. string name;
  37. string birth;
  38. getline(cin, name);
  39. fullName(name);
  40. x.name = name;
  41.  
  42. cin >> birth;
  43. cin.ignore();
  44. x.stt = i + 1;
  45. stringstream ss(birth);
  46. getline(ss, x.d, '/');
  47. getline(ss, x.m, '/');
  48. getline(ss, x.y, '/');
  49.  
  50. vt.emplace_back(x);
  51. }
  52. for (auto &x : vt) {
  53. cout << "B24DCCN" << setw(3) << setfill('0') << x.stt << " ";
  54. cout << x.name ;
  55. cout << setw(2) << setfill('0') << x.d << "/"
  56. << setw(2) << setfill('0') << x.m << "/"
  57. << setw(4) << setfill('0') << x.y << "\n";
  58. }
  59.  
  60. }
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
Standard output is empty