当前位置:网站首页>华为 od js 拼接URL
华为 od js 拼接URL
2022-07-16 19:49:00 【大鸡腿最好吃】
给定一个URL前缀和URL后缀,通过","分割,需要将其连接为一个完整的URL,如果前缀结尾和后缀开头都没有“/”,需自动补上“/”连接符,如果前缀结尾和后缀开头都为“/”,需自动去重。
约束:不用考虑前后缀URL不合法情况。
输入描述:
URL前缀(一个长度小于100的字符串),URL后缀(一个长度小于100的字符串)。
输出描述:
拼接后的URL。
示例1
输入
/acm,/bb
输出
/acm/bb
示例2
输入
/abc/,/bcd
输出
/abc/bcd
示例3
输入
/acd,bef
输出
示例4
输入
,
输出
/
let a = readline().split(",");
let res = "";
for(let i=0;i<a.length;i++){
if(a[i]!="" && a[i]!="/"){
//把改字段里面的/全部替换为''
res+="/"+a[i].replaceAll('/',"");
}
}
print(res=="" ? "/" : res);边栏推荐
- C语言几种特殊标准定义和用法
- App packet capturing tips how to break network exceptions?
- Four knapsack problems of dynamic programming
- [UCOS III source code analysis] - system initialization
- 容器内部查看服务状态报错:Failed to get D-Bus connection: Operation not permitted
- 将博客搬至CSDN
- 你的接口多少QPS?
- Pyqt5 color dialog (qcolordialog)
- What if win11 always pops up the input experience
- Towhee daily model weekly report
猜你喜欢

information gathering
![Sword finger offer 44 [a bit in the number sequence] [100%, 100%]](/img/fd/1d14ea8a1bdfbd53366d4781586797.png)
Sword finger offer 44 [a bit in the number sequence] [100%, 100%]

CMU15445 (Fall 2019) 之 Project#4 - Logging & Recovery 详解

是时候聊聊RPA了

How to open 3D viewer in win11

Information system project manager must recite the core examination site (44) planning risk response

蓝牙耳机哪个品牌降噪好?2022降噪耳机排行榜

如何在自动化测试中使用MitmProxy获取数据返回?

MP1655GG-Z MPS/美国芯源 MOSFET 的开关模式转换器 资源 方案

Omnivore, a non picky AI model, focuses on images, videos and 3D data!
随机推荐
How to open 3D viewer in win11
What if win11 always pops up the input experience
什么样的无线蓝牙耳机好?综合性能最好的蓝牙耳机
你的接口多少QPS?
Linux solves the problem of oracle:ora-12537: tns:connection closed
Sword finger offer 44 [a bit in the number sequence] [100%, 100%]
Pyqt5 color dialog (qcolordialog)
网络基础VlAN配置(eNSP、Cisco)
数字员工未来可期?盘点RPA在八大行业领域的应用案例
8大主流OA办公软件比拼,传统VS新秀你PICK谁?
Network infrastructure VLAN configuration trunk Technology (ENSP, Cisco)
What kind of wireless Bluetooth headset is good? Bluetooth headset with the best comprehensive performance
Leetcode 1309. Decode letter to integer mapping (yes, once)
Towhee 每日模型周报
It's time to talk about RPA
Application of Apache abox-700 industrial computer minipicecan card in electric power inspection robot
[sequential reading and writing of data files in C language]
New energy enterprises use low code development platform to build a new mode of digital management case analysis
Anaconda's understanding and a brief introduction to some editors related to it
The upgraded ranking activity is hot again. Looking around, it's full of bonuses