Advertisement
SeriousVenom

06.02.2020

Feb 5th, 2020
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. // 06.02.2020.cpp: определяет точку входа для консольного приложения.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <string>
  7. #include <stack>
  8. #include <queue>
  9.  
  10.  
  11. using namespace std;
  12.  
  13. int main()
  14. {
  15.     /*stack <char> stk;
  16.     queue <char> que;
  17.     bool flag = false;
  18.  
  19.     string S;
  20.     getline(cin, S);
  21.     for (int i = 0; i < S.length(); i++) {
  22.         stk.push(S[i]);
  23.         que.push(S[i]);
  24.     }
  25.    
  26.  
  27.     for (int i = 0; i < S.length(); i++) {
  28.  
  29.         char a = stk.top();
  30.         char b = que.front();
  31.  
  32.         if (a == b) {
  33.             stk.pop();
  34.             que.pop();
  35.         }
  36.         else { flag = true; }
  37.    
  38.     };
  39.    
  40.     if (flag) { cout << "Not palindrom \n"; }
  41.     else { cout << "Is Palindrom \n"; }*/
  42.    
  43.  
  44.     queue <char> que;
  45.  
  46.     string S;
  47.     getline(cin, S);
  48.  
  49.     for (int i = 0; i < S.length(); i++) {
  50.         if (S[i] == ' ')
  51.         que.push(S[i]);
  52.     }
  53.  
  54.    
  55.  
  56.    
  57.  
  58.     return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement