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 a6b7111 commit f90a3fcCopy full SHA for f90a3fc
Make The String Great/kata.go
@@ -0,0 +1,25 @@
1
+package kata
2
+
3
+func makeGood(s string) string {
4
+ var stack []byte
5
+ for i := 0; i < len(s); i++ {
6
+ if s[i] >= 'a' && s[i] <= 'z' {
7
+ if len(stack) > 0 && stack[len(stack)-1] >= 'A' && stack[len(stack)-1] <= 'Z' {
8
+ if (stack[len(stack)-1] + 32) == s[i] {
9
+ stack = stack[:len(stack)-1]
10
+ continue
11
+ }
12
+ stack = append(stack, s[i])
13
14
15
16
+ } else {
17
+ if len(stack) > 0 && stack[len(stack)-1] == (s[i]+32) {
18
19
20
21
22
23
24
+ return string(stack)
25
+}
0 commit comments