The new operating system BerOS has a nice feature. It is possible to use any number of characters '/' as a delimiter in path instead of one traditional '/'. For example, strings //usr///local//nginx/sbin// and /usr/local/nginx///sbin are equivalent. The character '/' (or some sequence of such characters) at the end of the path is required only in case of the path to the root directory, which can be represented as single character '/'.

A path called normalized if it contains the smallest possible number of characters '/'.

Your task is to transform a given path to the normalized form.

Input

The first line of the input contains only lowercase Latin letters and character '/' — the path to some directory. All paths start with at least one character '/'. The length of the given line is no more than 100 characters, it is not empty.

Output

The path in normalized form.

Example

Input
//usr///local//nginx/sbin
Output
/usr/local/nginx/sbin

读懂题意就好,英语不好。
代码:
#include <iostream>
#include <cstring>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <cmath> using namespace std; int main()
{
char s[];
char t[];
scanf("%s",s);
int i = ,j = ,c = ;
while(s[i])
{
t[j ++] = s[i];
if(s[i] == '/')
{
c ++;
while(s[i + ] == '/')i ++;
}
i ++;
}
if(c > )while(t[j - ] == '/')j --;
t[j] = '\0';
printf("%s",t);
}

BerOS file system的更多相关文章

  1. Code Forces 20A BerOS file system

    A. BerOS file system time limit per test 2 seconds memory limit per test 64 megabytes input standard ...

  2. CDOJ_327 BerOS file system

    原题地址:http://acm.uestc.edu.cn/#/problem/show/327 The new operating system BerOS has a nice feature. I ...

  3. 题解 CF20A 【BerOS file system】

    对于此题,我的心近乎崩溃 这道题,注意点没有什么,相信大佬们是可以自己写出来的 我是蒟蒻,那我是怎么写出来的啊 好了,废话少说,开始进入正题 这道题,首先我想到的是字符串的 erase 函数,一边运行 ...

  4. BerOS File Suggestion(字符串匹配map)

    BerOS File Suggestion(stl-map应用) Polycarp is working on a new operating system called BerOS. He asks ...

  5. Design and Implementation of the Sun Network File System

    Introduction The network file system(NFS) is a client/service application that provides shared file ...

  6. 乌版图 read-only file system

    今天在启动虚拟机的时候,运行命令svn up的时候,提示lock,并且read-only file system,这个....我是小白啊,怎么办?前辈在专心写代码,不好打扰,果断找度娘啊 于是乎,折腾 ...

  7. File system needs to be upgraded. You have version null and I want version 7

    安装hbase时候报错: File system needs to be upgraded. You have version null and I want version 7 注: 我安装的hba ...

  8. Linux系统启动错误 contains a file system with errors, check forced解决方法

    /dev/sda1 contains a file system with errors, check forced./dev/sda1: Inodes that were part of a cor ...

  9. Linux 执行partprobe命令时遇到Unable to open /dev/sr0 read-write (Read-only file system)

    在使用fdisk创建分区时,我们会使用partprobe命令可以使kernel重新读取分区信息,从而避免重启系统,但是有时候会遇到下面错误信息"Warning: Unable to open ...

随机推荐

  1. 浅谈HTTPS协议

    前言 理解协议是做接口测试的前提.本文主要向大家展示博主对HTTPS协议的理解,网上有诸多资料,有些写得过于晦涩难懂,尤其是需要密码学的一些知识.我做了一下简单的整理,刨除复杂的底层实现,单从理解SS ...

  2. jQuery UI入门

    jQuery UI是jQuery的一个插件集,为jQuery的核心库添加了新的功能. jQUery UI库可以从http://jquery.com下载. 下载一个ZIP文件jquery-ui-1.9. ...

  3. Sublime Text3 打开文档乱码

    一.安装包管理器使用Ctrl+~快捷键或者通过View->Show Console菜单打开命令行,粘贴如下代码 import urllib.request,os; pf = 'Package C ...

  4. Hadoop相关知识整理系列之一:HBase基本架构及原理

    1. HBase框架简单介绍 HBase是一个分布式的.面向列的开源数据库,它不同于一般的关系数据库,是一个适合于非结构化数据存储的数据库.另一个不同的是HBase基于列的而不是基于行的模式.HBas ...

  5. 字符串处理sdut 2411

    题目:http://www.sdutacm.org/sdutoj/problem.php?action=showproblem&problemid=2411 关于字符串处理的题,此题坑点很多w ...

  6. Codeforces Round #390 (Div. 2) A B C D

    这是一场比较难的div2 ... 比赛的时候只出了AB A很有意思 给出n个数 要求随意的把相邻的数合并成任意多数 最后没有为0的数 输出合并区间个数与区间 可以想到0可以合到任何数上并不改变该数的性 ...

  7. JMeter常用的调试工具

    JMeter常用的调试工具有如下五种: 1.View Tree:查看结果树.含请求信息.响应信息等,请求头信息中的cookie信息一般默认不会显示,可通过修改JMeter配置参数进行显示.日常大家用的 ...

  8. Spark- 共享变量

    Shared Variables Normally, when a function passed to a Spark operation (such as map or reduce) is ex ...

  9. 自己编写each函数

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  10. Sharded数据分片定位数据

    [http://www.tuicool.com/articles/UNnqUnU] Jedis分片 动机 在普通的Redis主/从方式,通常有一个主服务器负责"write"请求,多 ...