fork download
  1. //time
  2.  
  3. int main() {
  4. freopen("acronym.in", "r", stdin);
  5. Keyboard_Crackers();
  6. string s;
  7. cin >> s;
  8. int a; cin >> a;
  9. vector<string>v;
  10. map<char, priority_queue<string, vector<string>, greater<string> > >mp;
  11. map<char, priority_queue<string, vector<string>, greater<string> > >::iterator it;
  12. while (a--)
  13. {
  14. string t;
  15. cin >> t;
  16. mp[t[0]].push(t);
  17. }
  18.  
  19. bool flag = 0;
  20. for (int i = 0; i < s.size(); i++) {
  21. if (mp.find(s[i]) != mp.end()) {
  22. it = mp.find(s[i]);
  23. //cout << it->first<< endl;
  24. priority_queue<string, vector<string>, greater<string> > temp;
  25. //multiset<string>::iterator z;
  26. temp = it->second;
  27. mp[s[i]].pop();
  28.  
  29. /* if (s[i]=='C'){
  30. for (auto z : temp) {
  31. cout << z << endl;
  32. } cout << temp.size()<<endl;
  33. }*/
  34. if (temp.empty()) {
  35. //cout << "wrong "<<endl;
  36. flag = 1;
  37. break;
  38. }
  39. else {
  40. string x = temp.top();
  41. v.push_back(x);
  42. temp.pop();
  43. it->second = temp;
  44. }
  45. }
  46. else {
  47. flag = 1;
  48. break;
  49. }
  50. }
  51. if (flag) {
  52. cout << "Impossible" << endl;
  53. }
  54. else {
  55. for (int i = 0; i < v.size(); i++) {
  56. cout << v[i] << " ";
  57. }
  58. cout << endl;
  59. }
  60.  
  61. }
  62.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:4:30: error: ‘stdin’ was not declared in this scope
   freopen("acronym.in", "r", stdin);
                              ^~~~~
prog.cpp:4:30: note: ‘stdin’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
prog.cpp:1:1:
+#include <cstdio>
 //time
prog.cpp:4:30:
   freopen("acronym.in", "r", stdin);
                              ^~~~~
prog.cpp:4:3: error: ‘freopen’ was not declared in this scope
   freopen("acronym.in", "r", stdin);
   ^~~~~~~
prog.cpp:5:2: error: ‘Keyboard_Crackers’ was not declared in this scope
  Keyboard_Crackers();
  ^~~~~~~~~~~~~~~~~
prog.cpp:6:2: error: ‘string’ was not declared in this scope
  string s;
  ^~~~~~
prog.cpp:6:2: note: suggested alternative: ‘struct’
  string s;
  ^~~~~~
  struct
prog.cpp:7:2: error: ‘cin’ was not declared in this scope
  cin >> s;
  ^~~
prog.cpp:7:2: note: suggested alternative: ‘main’
  cin >> s;
  ^~~
  main
prog.cpp:7:9: error: ‘s’ was not declared in this scope
  cin >> s;
         ^
prog.cpp:9:2: error: ‘vector’ was not declared in this scope
  vector<string>v;
  ^~~~~~
prog.cpp:9:16: error: ‘v’ was not declared in this scope
  vector<string>v;
                ^
prog.cpp:10:2: error: ‘map’ was not declared in this scope
  map<char, priority_queue<string, vector<string>, greater<string> > >mp;
  ^~~
prog.cpp:10:2: note: suggested alternative: ‘main’
  map<char, priority_queue<string, vector<string>, greater<string> > >mp;
  ^~~
  main
prog.cpp:10:6: error: expected primary-expression before ‘char’
  map<char, priority_queue<string, vector<string>, greater<string> > >mp;
      ^~~~
prog.cpp:11:6: error: expected primary-expression before ‘char’
  map<char, priority_queue<string, vector<string>, greater<string> > >::iterator it;
      ^~~~
prog.cpp:14:9: error: expected ‘;’ before ‘t’
   string t;
         ^~
         ;
prog.cpp:15:10: error: ‘t’ was not declared in this scope
   cin >> t;
          ^
prog.cpp:16:2: error: ‘mp’ was not declared in this scope
  mp[t[0]].push(t);
  ^~
prog.cpp:21:7: error: ‘mp’ was not declared in this scope
   if (mp.find(s[i]) != mp.end()) {
       ^~
prog.cpp:22:4: error: ‘it’ was not declared in this scope
    it = mp.find(s[i]);
    ^~
prog.cpp:22:4: note: suggested alternative: ‘i’
    it = mp.find(s[i]);
    ^~
    i
prog.cpp:24:4: error: ‘priority_queue’ was not declared in this scope
    priority_queue<string, vector<string>, greater<string> > temp;
    ^~~~~~~~~~~~~~
prog.cpp:24:41: error: expected primary-expression before ‘,’ token
    priority_queue<string, vector<string>, greater<string> > temp;
                                         ^
prog.cpp:24:43: error: ‘greater’ was not declared in this scope
    priority_queue<string, vector<string>, greater<string> > temp;
                                           ^~~~~~~
prog.cpp:24:59: error: expected primary-expression before ‘>’ token
    priority_queue<string, vector<string>, greater<string> > temp;
                                                           ^
prog.cpp:24:61: error: ‘temp’ was not declared in this scope
    priority_queue<string, vector<string>, greater<string> > temp;
                                                             ^~~~
prog.cpp:40:11: error: expected ‘;’ before ‘x’
     string x = temp.top();
           ^~
           ;
prog.cpp:41:17: error: ‘x’ was not declared in this scope
     v.push_back(x);
                 ^
prog.cpp:52:3: error: ‘cout’ was not declared in this scope
   cout << "Impossible" << endl;
   ^~~~
prog.cpp:52:27: error: ‘endl’ was not declared in this scope
   cout << "Impossible" << endl;
                           ^~~~
prog.cpp:52:27: note: suggested alternative: ‘enum’
   cout << "Impossible" << endl;
                           ^~~~
                           enum
prog.cpp:56:2: error: ‘cout’ was not declared in this scope
  cout << v[i] << " ";
  ^~~~
prog.cpp:58:3: error: ‘cout’ was not declared in this scope
   cout << endl;
   ^~~~
prog.cpp:58:11: error: ‘endl’ was not declared in this scope
   cout << endl;
           ^~~~
prog.cpp:58:11: note: suggested alternative: ‘enum’
   cout << endl;
           ^~~~
           enum
stdout
Standard output is empty