A. BerOS file system
time limit per test

2 seconds

memory limit per test

64 megabytes

input

standard input

output

standard output

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.

Examples
input
//usr///local//nginx/sbin
output
/usr/local/nginx/sbin
遇到多个////
只输出一个/
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#include <stdio.h> using namespace std;
char a[105];
char b[105];
int main()
{
gets(a);
bool tag=0;
int len=strlen(a);
int cnt=0;
for(int i=0;i<len;i++)
{
if(a[i]!='/')
{
// cout<<a[i];
b[cnt++]=a[i];
tag=0;
} else
{
if(!tag)
{
//cout<<a[i];
b[cnt++]=a[i];
tag=1;
}
}
}
if(b[0]!='/')
cout<<'/';
for(int i=0;i<cnt;i++)
{
if(i==cnt-1&&b[i]=='/'&&cnt!=1)
continue;
cout<<b[i];
}
cout<<endl;
return 0;
}

Code Forces 20A BerOS file system的更多相关文章

  1. BerOS file system

    The new operating system BerOS has a nice feature. It is possible to use any number of characters '/ ...

  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. Low-overhead enhancement of reliability of journaled file system using solid state storage and de-duplication

    A mechanism is provided in a data processing system for reliable asynchronous solid-state device bas ...

  5. Linux File System

    目录 . Linux文件系统简介 . 通用文件模型 . VFS相关数据结构 . 处理VFS对象 . 标准函数 1. Linux文件系统简介 Linux系统由数以万计的文件组成,其数据存储在硬盘或者其他 ...

  6. [CareerCup] 8.9 An In-memory File System 内存文件系统

    8.9 Explain the data structures and algorithms that you would use to design an in-memory file system ...

  7. TFS(Taobao File System)安装方法

    文章目录: 一.TFS(Taobao File System)安装方法 二.TFS(Taobao File System)配置dataServer.分区.挂载数据盘 三.TFS(Taobao File ...

  8. HTML5之本地文件系统API - File System API

    HTML5之本地文件系统API - File System API 新的HTML5标准给我们带来了大量的新特性和惊喜,例如,画图的画布Canvas,多媒体的audio和video等等.除了上面我们提到 ...

  9. File System Shell

    Overview appendToFile cat chgrp chmod chown copyFromLocal copyToLocal count cp du dus expunge get ge ...

随机推荐

  1. Linux下改动Matlab配置文件支持C++ 11标准以生成mex

    进入matlab 输入mex -v命令查看当前配置 输入命令改动配置文件 命令: !sudo gedit /usr/local/MATLAB/R2013a/bin/mexopts.sh 加入下面蓝色内 ...

  2. min宏的学习

    1.先上实现代码: #define __min(t1, t2, min1, min2, x, y) ({ \ t1 min1 = (x); \ t2 min2 = (y); \ (void) (&am ...

  3. JMeter学习笔记(二)

    3.JMeter测试计划要素 JMeter中一个脚本即是一个测试计划,也是一个管理单元.JMeter的请求模拟与并发数(设置线程数,一个线程代表一个虚拟用户)设置都在脚本文件中一起设置. 要素一:脚本 ...

  4. Jackson 时间格式化,时间注解 @JsonFormat 与 @DatetimeFormat 用法、时差问题说明

    @JsonFormat 使用 我们可以有两种用法(我知道的),在对象属性上,或者在属性的 getter 方法上,如下代码所示: 增加到属性上: ... ... /**更新时间 用户可以点击更新,保存最 ...

  5. Selenium - 设置元素等待

    一.sleep () 休眠方法   --time 固定等待 在开发自动化框架过程中,最忌讳使用Python自带模块的time的sleep方法进行等待,虽然可以自定义等待时间,但当网络条件良好时, 依旧 ...

  6. 坑爹的A标签 href

    A标签 href在与click事件同时响应时,如果click事件有提交表单动作,href会阻拦表单提交,解决 1.去掉href 2.href="javascript:void();" ...

  7. spring 注解@Resource @Autowired区别

    1.@Autowired寻找类的时候默认是ByType,也就是通过类的类型来寻找类.不过,也可以通过借助@Qualifier("name")来指定寻找的类名 @Autowired ...

  8. pictureBox

    private void pictureBox1_Click(object sender, EventArgs e) { openFileDialog1.Filter="*.jpg|*.jp ...

  9. Github优秀开源项目

    王潜升 https://github.com/code4craft/webmagic 一个爬虫框架,除了不会反爬虫外(当然可以自己加)其他都很牛逼.这个项目更新还是很快的.   ansi分词  htt ...

  10. Linux curl 模拟form表单提交信息和文件

    Linux curl 模拟form表单提交信息和文件   curl是一个命令行方式下传输数据的开源传输工具,支持多种协议:FTP.HTTP.HTTPS.IMAP.POP3.TELNET等,功能超级强大 ...