Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <sstream>
  6. #include <queue>
  7.  
  8. using namespace std;
  9.  
  10. /**
  11. * Auto-generated code below aims at helping you parse
  12. * the standard input according to the problem statement.
  13. **/
  14.  
  15. int main()
  16. {
  17. int L;
  18. cin >> L; cin.ignore();
  19. int H;
  20. cin >> H; cin.ignore();
  21. string T;
  22. vector<vector<char>>art;
  23. vector<vector<char>>output;
  24. queue<int>indexes;
  25.  
  26. getline(cin, T);
  27.  
  28. for (int i = 0; i < H; i++) {
  29.  
  30. string ROW;
  31. getline(cin, ROW);
  32. vector<char>temp;
  33. for( char &letter : ROW)
  34. {
  35. temp.push_back(letter);
  36. }
  37. art.push_back(temp);
  38. }
  39.  
  40. int indexInArt=0;
  41.  
  42. for(char letter : T)
  43. {
  44. indexInArt=0;
  45. if(letter>='a' && letter<='z')
  46. {
  47. indexInArt=letter-'a'+1;
  48. }else if (letter>='A' && letter<='Z')
  49. {
  50. indexInArt=letter-'A'+1;
  51. }else if (letter==' ')
  52. {
  53. indexInArt=32;
  54. }else
  55. {
  56. indexInArt=27;
  57. }
  58. indexes.push(indexInArt);
  59.  
  60. }
  61.  
  62. while(!indexes.empty())
  63. {
  64. int index=indexes.front();
  65.  
  66. for(int row=0; row<H; ++row)
  67. {
  68. vector<char>temp;
  69. for(int col=(index*L)-4; col<index*L; ++col)
  70. {
  71. temp.push_back(art[row][col]);
  72.  
  73. }
  74. output.push_back(temp);
  75. }
  76. indexes.pop();
  77.  
  78. }
  79.  
  80. for(auto a :output)
  81. {
  82. for(auto b : a)
  83. {
  84. cout<<b;
  85. }
  86. cout<<endl;
  87.  
  88. }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement