diff options
Diffstat (limited to 'challenge-264/zapwai/javascript/ch-1.js')
| -rw-r--r-- | challenge-264/zapwai/javascript/ch-1.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/challenge-264/zapwai/javascript/ch-1.js b/challenge-264/zapwai/javascript/ch-1.js new file mode 100644 index 0000000000..65f7c084e2 --- /dev/null +++ b/challenge-264/zapwai/javascript/ch-1.js @@ -0,0 +1,26 @@ +let str = 'PeRlwEKLy'; +console.log("Input:", str); +console.log("Output:", proc(str)); + +function proc(str) { + letters = str.split(""); + let upper = []; + let lower = []; + for (let l of letters) { + if (l.toUpperCase() == l) { + upper.push(l); + } else { + lower.push(l); + } + } + common = []; + for (let u of upper) { + for (let l of lower) { + if (u.toLowerCase() == l) { + common.push(u); + } + } + } + common = common.sort(); + return common[common.length-1]; +} |
