ou have to extract a portion of the file name as follows:
Assume it will start with date represented as long number
Followed by an underscore
Youll have then a filename with an extension
it will always have an extra extension at the end
Inputs:
1231231223123131_FILE_NAME.EXTENSION.OTHEREXTENSION
1_This_is_an_otherExample.mpg.OTHEREXTENSIONadasdassdassds34
1231231223123131_myFile.tar.gz2
Outputs
FILE_NAME.EXTENSION
This_is_an_otherExample.mpg
myFile.tar
The recommend way to solve it is using RegEx and specifically groups.
'매일매일개발 > Codewars' 카테고리의 다른 글
codewars #33 Vasya - Clerk (6kyu) (1) | 2018.05.02 |
---|---|
codewars #32 Dubstep (6kyu) (0) | 2018.05.01 |
codewars #30 Psychic (3kyu) (1) | 2018.04.27 |
codewars #29 Multiples of 3 or 5 (6kyu) (0) | 2018.04.26 |
codewars #28 Valid Braces (4kyu) (1) | 2018.04.25 |