leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1678.cpp (386B)


      1 class Solution {
      2   public:
      3     string interpret(const string command) const {
      4         string res;
      5 
      6         for (int i = 0; i < size(command); i++) {
      7             if (command[i] == 'G')
      8                 res += 'G';
      9             else if (command[i + 1] == ')')
     10                 res += 'o', i += 1;
     11             else
     12                 res += "al", i += 3;
     13         }
     14 
     15         return res;
     16     }
     17 };