【题目】
You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation
of each word in wordsexactly ...
分类:
移动开发 时间:
2015-05-22 09:50:36
阅读次数:
222
这篇博文我们按照每一种正则表达式符号来整理。
1)行首定位符“^”:匹配行首的字符
#-----------------------------/chapter8/ex8-2.sh------------------
#! /bin/bash
#列出/etc目录中的以字母po开头的文件
str=`ls /etc | grep "^po"`
echo "$str"
注意:str变量的赋值,...
分类:
其他好文 时间:
2015-05-21 12:52:49
阅读次数:
101
很简单的字符串匹配问题,直接用栈就可以实现,为使程序更加高效,当要匹配的字符种类比较多的时候可以考虑用HashMap来保存匹配对...
分类:
其他好文 时间:
2015-05-21 10:55:47
阅读次数:
100
一、Varnish的配置语言VCLVarnish的所有配置都是通过VCL(varnishconfigurelanguage)来配置的。它是一种基于“域”(domainspecific)的简单编程语言,它支持有限的算术运算和逻辑运算操作、允许使用正则表达式进行字符串匹配、允许用户使用set自定义变量、支持if判断语句,也有..
分类:
编程语言 时间:
2015-05-20 02:11:39
阅读次数:
713
对于一个字符串 s 以及子串 t ,拓展KMP可以用来求 t 与 s 的每个子串的最长公共前缀 ext [ i ],当然,如果有某个 ext 值等于 t 串的长度 lent ,那么就说明从其对应的 i 开始的一个长 lent 的子串即为 t 串,因此可以同样线性地求出 s 串中的每个 t 子串的出现...
分类:
其他好文 时间:
2015-05-19 18:54:45
阅读次数:
115
我的程序:#include#include#include#includeusing namespace std;int main(){ string s; cin>>s; int bl,m; cin>>bl; cin>>m; int count=0; vectors1; for(int i=...
分类:
其他好文 时间:
2015-05-19 18:23:31
阅读次数:
200
DescriptionLet's consider one interesting word game. In this game you should transform one word into another through special operations.Let's say we h...
分类:
其他好文 时间:
2015-05-18 18:26:43
阅读次数:
151
字典树就是将一个个单词按照字母顺序建成树,可以用于单词去重、计算每种单词的出现次数、计算共出现多少种单词 1 #include 2 #include 3 const int maxm=5050; //所有单词的总长度,约总单词数*5 4 5 struct trie{ 6 in...
分类:
其他好文 时间:
2015-05-17 07:04:37
阅读次数:
197
理论参考:阮一峰老师http://www.ruanyifeng.com/blog/2013/05/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm.html#include "stdafx.h"#include #include #include #inclu...
分类:
其他好文 时间:
2015-05-16 01:23:27
阅读次数:
160
lex负责词法解析,而yacc负责语法解析,其实说白了就是lex负责根据指定的正则表达式,将输入的字符串匹配成一个一个的token,同时允许用户将当前匹配到的字符串进行处理,并且允许返回一个标识当前token的标识码。而yacc则负责进行语法解析,将一个个的token最终形成一个完整的语法。 lex...
分类:
其他好文 时间:
2015-05-13 14:30:30
阅读次数:
109