leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE |
1678.cpp (386B)
0 class Solution {
1 public:
2 string interpret(const string command) const {
3 string res;
5 for (int i = 0; i < size(command); i++) {
6 if (command[i] == 'G')
7 res += 'G';
8 else if (command[i + 1] == ')')
9 res += 'o', i += 1;
10 else
11 res += "al", i += 3;
12 }
14 return res;
15 }
16 };