fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. #define fi first
  4. #define se second
  5. #define deb(x) cout << "[" << #x << "]: " << x << endl;
  6. #define debg(i ,x) cout << "[" << i << "]: " << x << endl;
  7. using namespace std;
  8. vector<string> st;
  9.  
  10. vector<string> solve(vector<string> st) {
  11. string ans;
  12. vector<string> v;
  13. for (auto s : st) {
  14. if (s.size() == 8) {
  15. char c = static_cast<char>(bitset<8>(s).to_ulong());
  16. if (c == ' ') {
  17. v.push_back(ans);
  18. ans = "";
  19. }
  20. else ans += c;
  21. }
  22. }
  23. if (!ans.empty()) v.push_back(ans);
  24. return v;
  25. }
  26.  
  27. int main() {
  28. ios_base::sync_with_stdio(false), cin.tie(), cout.tie();
  29. string line, s;
  30. getline(cin, line);
  31. stringstream ss(line);
  32.  
  33. while (ss >> s) {
  34. st.push_back(s);
  35. }
  36.  
  37. vector<string> ans = solve(st);
  38.  
  39. for (auto x : ans) {
  40. cout << x << " ";
  41. }
  42. return 0;
  43. }
  44.  
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
Standard output is empty