1
0
Fork 0
mirror of https://gitlab.com/mfocko/LeetCode.git synced 2024-11-10 00:09:06 +01:00
LeetCode/cs/removing-stars-from-a-string.cs
Matej Focko 7e9a865db7
cs: add “2390. Removing Stars From a String”
Signed-off-by: Matej Focko <mfocko@redhat.com>
2024-01-07 21:03:07 +01:00

18 lines
412 B
C#

public class Solution {
public string RemoveStars(string s) {
var sb = new StringBuilder();
foreach (var c in s) {
switch (c) {
case '*':
sb.Remove(sb.Length - 1, 1);
break;
default:
sb.Append(c);
break;
}
}
return sb.ToString();
}
}