通过使用 tr,您可以非常容易地实现 sed 的许多最基本功能。您可以将 tr 看作为 sed 的(极其)简化的变体:它可以用一个字符来替换另一个字符,或者可以完全除去一些字符。您也可以用它来除去重复字符。这就是所有 tr 所能够做的。 tr用来从标准输入中通过替换或删除操作进行字符转换。tr主要用 ...
分类:
系统相关 时间:
2017-11-28 01:37:35
阅读次数:
194
忘记在网上哪里看到过的。不是原创--特此声明 ...
分类:
其他好文 时间:
2017-11-13 14:50:44
阅读次数:
120
Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may a ...
分类:
其他好文 时间:
2017-10-28 11:08:54
阅读次数:
199
描述: 给定一个字符串,找到最长子串的长度,而不重复字符。 例子: 给定"abcabcbb"的答案是"abc",长度是3。 给定"bbbbb"的答案是"b",长度为1。 给定"pwwkew"的答案是"wke",长度为3.请注意,答案必须是子字符串,"pwke"是子序列,而不是子字符串。 LeetCo ...
分类:
其他好文 时间:
2017-10-14 12:10:07
阅读次数:
420
Set 里的元素是不能重复的,元素重复与否是使用 equals()方法进行判断的。equals()和==方法决定引用值是否指向同一对象 equals()在类中被覆盖,为的是当两个分离的对象的内容和类型相配的话,返回真值。 equals()和==的区别 ==操作符专门用来比较两个变量的值是否相等,也就 ...
分类:
其他好文 时间:
2017-10-06 16:54:28
阅读次数:
232
Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return -1. For ...
分类:
其他好文 时间:
2017-10-06 13:55:06
阅读次数:
144
Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return -1.For ... ...
分类:
其他好文 时间:
2017-10-04 23:51:48
阅读次数:
582
问题: 给定一个字符串,找到最长子串的长度,而不重复字符。 例子: 给定"abcabcbb"的答案是"abc",长度是3。 给定"bbbbb"的答案是"b",长度为1。 给定"pwwkew"的答案是"wke",长度为3.请注意,答案必须是子字符串,"pwke"是子序列,而不是子字符串。 解法一(超时 ...
分类:
其他好文 时间:
2017-09-28 14:14:57
阅读次数:
175
对于字符串的处理,有很多需要把重复字符串去掉的问题,但是直接比较字符串会出现很多问题。 例如,我将 "abc","bbb","cba",直接sb的变成数字进行比较,会导致将这三个字符串判断为一样的(233) 一般智商正常情况下 , 直接比较 判重 需要将字符串一个一个比对, 所以就会浪费大量时间。 ...
分类:
其他好文 时间:
2017-09-17 22:02:41
阅读次数:
287
#include #include bool cnt[30]; int main() { char t; int ans=0; //重复字符数 int num=0; //字符长度 memset(cnt,false,sizeof(cnt)); while(1) { t=getchar(); if(t=... ...
分类:
其他好文 时间:
2017-09-01 00:57:15
阅读次数:
174