当前位置:网站首页>Huawei machine test question: splicing URL
Huawei machine test question: splicing URL
2022-06-25 06:00:00 【JOEL-T99】
Scala Realization
Title Description :
- Given a url The prefix and url suffix , adopt , Division It needs to be connected as a complete url
- If there is no end of prefix or beginning of suffix /, Need automatic replenishment / Connector
- If both the end of the prefix and the beginning of the suffix are /, Need automatic weight removal
- constraint : Don't worry about the prefix URL Illegal situation
Input description :
- url Prefix ( A length less than 100 String ) url suffix ( A length less than 100 String )
Output description :
- After splicing url
Example
Input :
- /acm,/bb
Output :
- /acm/bb
Input :
- /abc/,/bcd
Output :
- /abc/bcd
Input :
- /acd,bef
Output :
- /acd/bef
Input :
- ,
Output :
- /
Code :
def main(args: Array[String]): Unit = {
// Get input
val urls = StdIn.readLine().split(",")
// Remove anomalies
if(urls.length == 0) {
println("/")
return
}
// relation url
val res = (urls.head + urls.last).replaceAll("/+","/")
// Output results
println(res)
}
边栏推荐
- What changes have taken place in the project file after SAP ui5 tools ran the Fiori add deploy config command
- The locally developed SAP ui5 application is deployed to the ABAP server to perform error analysis
- Yunda's cloud based business in Taiwan construction 𞓜 practical school
- Day21 JMeter usage basis
- ThreadLocal
- Technology Review: what is the evolution route of container technology? What imagination space is there in the future?
- Day16 (regular expression, enumeration)
- How do product managers get started? How do they learn when no one takes them?
- Guava-IO
- cacacahe
猜你喜欢

Distributed solar photovoltaic inverter monitoring
Technology inventory: Technology Evolution and Future Trend Outlook of cloud native Middleware

Semantic segmentation cvpr2020 unsupervised intra domain adaptation for semantic segmentation through self supervision
SAP ui5 application development tutorial XXIX - Introduction to routing and navigation functions of SAP ui5 trial version
Vscode voice notes to enrich information (medium)

Word quickly makes multiple single-sided table labels, number plates, etc

Laravel8 fill data
Go quiz: considerations for function naming return value from the go interview question (more than 80% of people answered wrong)

Soft exam information system project manager_ Information system security management - Senior Information System Project Manager of soft test 026

Semantic segmentation cvpr2019-advance: advantageous enterprise minimization for domain adaptation in semantic segmentation
随机推荐
C simple operation mongodb
PAT (Advanced Level) Practice 1025
CST8227
Day19 (variable parameter, enhanced for loop traversal, generic wildcard <? >, TreeSet, linkedhashset, nested traversal of sets, set set, static import,)
Get the first letter of Chinese phonetic alphabet in Excel and capitalize it
Oracle SQL statement operand: rounding, rounding, differentiation and formatting
Farewell to Lombok in 996
Learn the interface test, see it is very good, and make a note
[open source sharing] deeply study KVM, CEPH, fuse features, including open source projects, code cases, articles, videos, architecture brain maps, etc
How do product managers get started? How do they learn when no one takes them?
Jz-066- motion range of robot
How SAP ui5 device type detection device API works
SAP Fiori tools and corresponding cli (command line interface)
Semantic segmentation cvpr2019-advance: advantageous enterprise minimization for domain adaptation in semantic segmentation
Synchonized introduction
Do you know what a three-tier architecture is?
Day22 send request and parameterization using JMeter
Monkey test of APP automation
Uname command – displays system information
The e-book "action guide for large organizations to further promote zero code application platform" was officially released!