Shortest code: Father and Son
Description:
shortest code: Father and Son
(Code length limit: 120 chars)
This is the challenge version of coding 3min series. If you feel difficult, please complete the simple version
Task
Every uppercase letter is Father, The corresponding lowercase letters is the Son.
Give you a string s
, If the father and son both exist, keep them. If it is a separate existence, delete them. Return the result.
For example:
sc("Aab")
should return "Aa"
sc("AabBc")
should return "AabB"
sc("AaaaAaab")
should return "AaaaAaa"
(father can have a lot of son)
sc("aAAAaAAb")
should return "aAAAaAA"
(son also can have a lot of father ;-)
Code length calculation
In javascript, we can't get the user's real code, we can only get the system compiled code. Code length calculation is based the compiled code.
For example:
If you typed sc=x=>x+1
after compile, it will be:sc=function(x){return x+1;}
Series
- Bug in Apple
- Father and Son
- Jumping Dutch act
- Planting Trees
- Reading a Book
- Eat watermelon
- Special factor
- Symmetric Sort
- Are they symmetrical?
- Guess the Hat
- Find the murderer
- Give me the equation
- Balance Attraction
- Max Value
- Regular expression compression
- Remove screws I
- Remove screws II
- Collatz Array(Split or merge)
- Trypophobia
- Virus in Apple
- Waiting for a Bus
- Tidy up the room
Similar Kata:
Stats:
Created | Mar 28, 2016 |
Published | Mar 29, 2016 |
Warriors Trained | 418 |
Total Skips | 12 |
Total Code Submissions | 1601 |
Total Times Completed | 222 |
JavaScript Completions | 222 |
Total Stars | 8 |
% of votes with a positive feedback rating | 94% of 81 |
Total "Very Satisfied" Votes | 74 |
Total "Somewhat Satisfied" Votes | 5 |
Total "Not Satisfied" Votes | 2 |