fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. string par;
  6. cin >> par;
  7. string x;
  8. cin >> x;
  9. if (x == "N") {
  10. cout << "TOTAL MEMBERS:1\n";
  11. cout << "COMISSION DETAILS\n";
  12. cout << par << ":250 INR\n";
  13. } else {
  14. string child;
  15. cin >> child;
  16. vector<string>v;
  17. string temp = "";
  18. for (int i = 0; i < child.length(); i++) {
  19. if (child[i] == ',') {
  20. v.push_back(temp);
  21. temp = "";
  22. }
  23. else if (child[i] != ' ')
  24. temp += child[i];
  25. }
  26. v.push_back(temp);
  27. cout << "TOTAL MEMBERS:" << v.size() + 1 << "\n";
  28. cout << "COMISSION DETAILS\n";
  29. cout << par << ":" << v.size() * 500 << " INR\n";
  30. for (auto a : v) {
  31. cout << a << ":" << "250 INR\n";
  32. }
  33. }
  34. }
Success #stdin #stdout 0s 4724KB
stdin
Standard input is empty
stdout
TOTAL MEMBERS:2
COMISSION DETAILS
:500 INR
:250 INR