Hacker News new | ask | show | jobs
by MisterTea 1075 days ago
You can shorten the loop to just tree conditionals:

  while (c = *input++) {
      if (c == 's') r++;
      if (c == 'p') r--;
  }