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. UI控件之UIScrollView

    UIScrollView:提供了滚动功能,用来显示超过一屏的视图 创建滚动视图 UIScrollView *scrollView=[[UIScrollView alloc]initWithFrame: ...

  2. swift的值类型和引用类型

    前言 最近在学设计模式中,发现 Swift 中的 struct,class 以及 enum 在一般的使用中能够做到互相替换,因此探究其背后的逻辑就十分有必要.而这一问题又引出了 Swift 中的值类型 ...

  3. VM上安装苹果虚拟机

    用了太久的Windows系统,看着Mac OS X的惊艳,相信很多朋友也和我一样,总想着能把玩一把Mac OS X系统吧?如果只是为了体验一下Mac OS X系统而购买一套Mac电脑,那是土豪做的事. ...

  4. 【转载】iptables、tc和ip命令

    2.3 CommandListener中的命令 CL一共定义了11个命令,这些命令充分反映了Netd在Android系统中网络管理和控制方面的职责.本节首先介绍Linux系统中常用的三个网络管理工具, ...

  5. 【Head First Servlets and JSP】笔记14:session再探 & Listener示例

    对于session的“CRUD” 会话迁移 别忘了HttpSessionBindingListener Listener示例 1.session的“增”与“删”——session的创建和撤销的调用主体 ...

  6. PHP面向对象之对象和引用

    在PHP中对象类型和简单变量类型表现可以说是大相径庭,很多数据类型都要可以在写时进行复制,如当写代码$a=$b时,两个变量因为赋予相同的值而告终.所以需要注意的是,这种情况用在对象时就会完全不同了. ...

  7. mysql里的ibdata1文件

    mysql大多数磁盘空间被 InnoDB 的共享表空间 ibdata1 使用.而你已经启用了 innodb_file_per_table,所以问题是: ibdata1存了什么? 当你启用了innodb ...

  8. vs+mysql+ef配置方法

    这次的项目用的是MySQL数据库,但是ADO.NET实体数据模型默认是不支持MySQL数据库的,本文档将介绍如何让VS ADO.NET实体数据模型支持MySQL. 一.安装插件 1.VS插件 mysq ...

  9. BZOJ-1396: 识别子串

    后缀自动机+线段树 先建出\(sam\),统计一遍每个点的\(right\)集合大小\(siz\),对于\(siz=1\)的点\(x\),他所代表的子串只会出现一次,设\(y=fa[x]\),则这个点 ...

  10. dedecms 织梦列表页标题增加显示页数

    判断是否为第一页,为第一页则不显示页数的代码: {dede:pagelist listsize='0' listitem='pageno' function='html2text(@me)' runp ...