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. Owncloud-X安装配置

    系统是基于Centos7.2 1.更改yum源: mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.back ...

  2. OC导入框架方式#import、@import的区别

    #import负责导入程序所需的文件的信息导入到程序中,随着程序所需的文件越来越多,程序就要导入更多的文件,这就带来了越来越长的编译时间,而且有大量重复的.为了解决这个问题可以采用以下办法解决,创建. ...

  3. SVN 过滤文件

    SVN新手最容易犯的一个错误: 就是把所有文件一股脑地全提交上去了. 这样很不好,因为这当中包含很多编译器自动生成的文件,还有中间文件. 这些文件可能每次编译都会不同,所以编译一次就冲突一次. 很显然 ...

  4. C++ IPv4与IPv6的兼容编码(转,出自http://blog.csdn.net/ligt0610/article/details/18667595)

    这里不再对IPv6 socket相关编程的基础知识进行讲解,只提供一个IP协议无关的服务端和客户端的代码,仅供参考. 服务端代码: #include <iostream> #include ...

  5. WebSocket 的后记

    一个美好的概念可以让策划无比幼稚和疯狂, 比如 H5 改变世界呀,小程序替代 APP 呀,现在即时通信也被公司里的他们认为 so easy 了. 这很尴尬好吧,WebSocket(以下简称 ws) 的 ...

  6. IMX6Q RTC驱动分析

    对于在工作中学习驱动的,讲究的是先使用,再理解.好吧,我们来看看板子里是如何注册的? 在板文件里,它的注册函数是这样的: imx6q_add_imx_snvs_rtc() 好吧,让我们追踪下去: 1 ...

  7. tomcat添加登录用户名密码

    tomcat版本 apache-tomcat-7.0.55.tar.gz 编辑 TOMCAT_HOME/conf/tomcat-users.xml在tomcat-users里面添加 <tomca ...

  8. DataX-MySQL(读写)

    DataX操作MySQL 一. 从MySQL读取 介绍 MysqlReader插件实现了从Mysql读取数据.在底层实现上,MysqlReader通过JDBC连接远程Mysql数据库,并执行相应的sq ...

  9. https阿里云证书购买与apache环境配置

    1.在阿里云云盾安全->CA证书购买 2.下载证书解压文件,一般有四个文件 3.在/etc/apache2  下创建一个文件夹cert 放入以上四个文件(路径可自己任意选择) 4.$sudo a ...

  10. Qt QSortFilterProxyModel示例代码, 使用方法

    1. QSortFilterProxyModel不能单独使用,它只是一个"代理",真正的数据需要另外的一个model提供,而且它是用来排序和过滤的. 2. 实现代码 #ifndef ...