提交 e5023060 编写于 作者: cosmicing's avatar cosmicing

Merge branch 'cosmicing-master-patch-04074' into 'master'

已删除14-Queue/11-CreateCircularDeque/11-SeqQueue/12-LinkQueue/.gitkeep,...

See merge request !4
#include<iostream>
#include<string>
#include<string.h>
#include<stack>
#include<assert.h>
using namespace std;
template <class T>
class MyCircularSeqQueue {
public:
/** Initialize your data structure here. Set the size of the deque to be k. */
MyCircularSeqQueue(T k) {
}
/** Adds an item at the front of Deque. Return true if the operation is successful. */
bool insertFront(T value) {
}
/** Adds an item at the rear of Deque. Return true if the operation is successful. */
bool insertLast(T value) {
}
/** Deletes an item from the front of Deque. Return true if the operation is successful. */
bool deleteFront() {
}
/** Deletes an item from the rear of Deque. Return true if the operation is successful. */
bool deleteLast() {
}
/** Get the front item from the deque. */
T getFront() {
}
/** Get the last item from the deque. */
T getRear() {
}
/** Checks whether the circular deque is empty or not. */
bool isEmpty() {
}
/** Checks whether the circular deque is full or not. */
bool isFull() {
}
};
/** Initialize your data structure here. Set the size of the deque to be k. */
template <typename T>
MyCircularSeqQueue<T>::MyCircularSeqQueue() {
}
/** Adds an item at the front of Deque. Return true if the operation is successful. */
template <typename T>
bool MyCircularSeqQueue<T>::insertFront(T value) {
}
/** Adds an item at the rear of Deque. Return true if the operation is successful. */
template <typename T>
bool MyCircularSeqQueue<T>::insertLast(T value) {
}
/** Deletes an item from the front of Deque. Return true if the operation is successful. */
template <typename T>
bool MyCircularSeqQueue<T>::deleteFront() {
}
/** Deletes an item from the rear of Deque. Return true if the operation is successful. */
template <typename T>
bool MyCircularSeqQueue<T>::deleteLast() {
}
/** Get the front item from the deque. */
template <typename T>
T MyCircularSeqQueue<T>::getFront() {
}
/** Get the last item from the deque. */
template <typename T>
T MyCircularSeqQueue<T>::getRear() {
}
/** Checks whether the circular deque is empty or not. */
template <typename T>
bool MyCircularSeqQueue<T>::isEmpty() {
}
/** Checks whether the circular deque is full or not. */
bool MyCircularSeqQueue<T>::isFull() {
}
};
/**
* Your MyCircularSeqQueue object will be instantiated and called as such:
* MyCircularSeqQueue* obj = new MyCircularSeqQueue(k);
* bool param_1 = obj->insertFront(value);
* bool param_2 = obj->insertLast(value);
* bool param_3 = obj->deleteFront();
* bool param_4 = obj->deleteLast();
* int param_5 = obj->getFront();
* int param_6 = obj->getRear();
* bool param_7 = obj->isEmpty();
* bool param_8 = obj->isFull();
*/
string stringToString(string input) {
assert(input.length() >= 2);
string result;
for (int i = 1; i < input.length() -1; i++) {
char currentChar = input[i];
if (input[i] == '\\') {
char nextChar = input[i+1];
switch (nextChar) {
case '\"': result.push_back('\"'); break;
case '/' : result.push_back('/'); break;
case '\\': result.push_back('\\'); break;
case 'b' : result.push_back('\b'); break;
case 'f' : result.push_back('\f'); break;
case 'r' : result.push_back('\r'); break;
case 'n' : result.push_back('\n'); break;
case 't' : result.push_back('\t'); break;
default: break;
}
i++;
} else {
result.push_back(currentChar);
}
}
return result;
}
string boolToString(bool input) {
return input ? "True" : "False";
}
int main() {
string line;
while (getline(cin, line)) {
string s = stringToString(line);
string ret = Solution().removeDuplicateLetters(s);
string out = (ret);
cout << out << endl;
}
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册