We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a672469 commit d08edd2Copy full SHA for d08edd2
LeetCode/goal-parser-interpretation.cpp
@@ -0,0 +1,31 @@
1
+// https://leetcode.com/problems/goal-parser-interpretation/
2
+
3
+class Solution
4
+{
5
+public:
6
+ string interpret(string command)
7
+ {
8
+ string result = "";
9
+ int stringLength = command.size();
10
11
+ for (int i = 0; i < stringLength; i++)
12
13
+ if (command[i] == 'G')
14
15
+ result += "G";
16
+ }
17
+ else if (command[i] == '(' && command[i + 1] == ')')
18
19
+ result += "o";
20
+ i++;
21
22
+ else
23
24
+ result += "al";
25
+ i += 3;
26
27
28
29
+ return result;
30
31
+};
0 commit comments