poj 1035 纯正的字符串水
| Time Limit: 2000MS | Memory Limit: 65536K | |
| Total Submissions: 22673 | Accepted: 8258 |
Description
?deleting of one letter from the word; ?replacing of one letter in the word with an arbitrary letter; ?inserting of one arbitrary letter into the word. Your task is to write the program that will find all possible replacements from the dictionary for every given word.
Input
Output
Sample Input
i
is
has
have
be
my
more
contest
me
too
if
award
#
me
aware
m
contest
hav
oo
or
i
fi
mre
#
Sample Output
me is correct
aware: award
m: i my me
contest is correct
hav: has have
oo: too
or:
i is correct
fi: i
mre: more me
#include<stdio.h>
#include<string.h>
#include<vector>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
string s;
int main(){
vector<string>q;
while(cin>>s){
if(s=="#")
break;
q.push_back(s); }
while(cin>>s){
if(s=="#")
break;
int len=s.size();
bool flag=false;
cout<<s;
for(int i=;i<q.size();i++){
if(s==q[i]){
flag=true;
cout<<" is correct"<<endl;
break;
}
} if(!flag){
cout<<":";
for(int i=;i<q.size();i++){
int len1=q[i].size();
int temp=len1-len;
if(temp>||temp<-)
continue;
int d=;
if(temp==){
for(int j=;j<len;j++){
if(s[j]!=q[i][j])
d++;
}
if(d==)
cout<<' '<<q[i];
} else if(temp==-){
for(int j=;j<len;j++){
if(s[j]==q[i][d]){
d++;
}
}
if(d==len1)
cout<<' '<<q[i];
} else if(temp==){
for(int j=;j<len1;j++){
if(s[d]==q[i][j]){
d++;
}
}
if(d==len)
cout<<' '<<q[i];
} }
cout<<endl;
} }
return ;
}
poj 1035 纯正的字符串水的更多相关文章
- POJ 1035 Spell checker 字符串 难度:0
题目 http://poj.org/problem?id=1035 题意 字典匹配,单词表共有1e4个单词,单词长度小于15,需要对最多50个单词进行匹配.在匹配时,如果直接匹配可以找到待匹配串,则直 ...
- poj 1035 Spell checker ( 字符串处理 )
Spell checker Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 16675 Accepted: 6087 De ...
- POJ 1035 代码+具体的目光
Spell checker Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 19319 Accepted: 7060 Descri ...
- poj 3080 Blue Jeans(水题 暴搜)
题目:http://poj.org/problem?id=3080 水题,暴搜 #include <iostream> #include<cstdio> #include< ...
- 1222: FJ的字符串 [水题]
1222: FJ的字符串 [水题] 时间限制: 1 Sec 内存限制: 128 MB 提交: 92 解决: 20 统计 题目描述 FJ在沙盘上写了这样一些字符串: A1 = “A” A2 = ...
- 1001 字符串“水”题(二进制,map,哈希)
1001: 字符串“水”题 时间限制: 1 Sec 内存限制: 128 MB提交: 210 解决: 39[提交][状态][讨论版] 题目描述 给出一个长度为 n 的字符串(1<=n<= ...
- poj 1007:DNA Sorting(水题,字符串逆序数排序)
DNA Sorting Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 80832 Accepted: 32533 Des ...
- poj 1035 Spell checker(水题)
题目:http://poj.org/problem?id=1035 还是暴搜 #include <iostream> #include<cstdio> #include< ...
- POJ 3080 (字符串水题) Blue Jeans
题意: 找出这些串中最长的公共子串(长度≥3),如果长度相同输出字典序最小的那个. 分析: 用库函数strstr直接查找就好了,用KMP反而是杀鸡用牛刀. #include <cstdio> ...
随机推荐
- phpmyadmin高级功能尚未完全设置部分功能未激活
1.登录phpmyadmin,点击导入,选择/var/ww/html/phpmyadmin/examples/create_tables.sql并执行 完成后可以看到多出了一个库phpmyadmin. ...
- SpringBoot发布WAR启动报错:Error assembling WAR: webxml attribute is required
Spring Boot发布war包流程: 1.修改web model的pom.xml <packaging>war</packaging> SpringBoot默认发布的都是j ...
- 项目部署到自己的IIS上
一般我们只能在本机上才可以开到我们的项目,这个是不需要连网的 如果想让我们的项目在网站中打开,别人也可以看到,就需要把我们的项目部署到服务器上了,输入IP就可以看到我们的项目 发布项目 然后发布网站 ...
- CSS 滤镜技巧与细节
本文主要介绍 CSS 滤镜的不常用用法,希望能给读者带来一些干货! 注意:ie不兼容 本文所描述的滤镜,指的是 CSS3 出来后的滤镜,不是 IE 系列时代的滤镜,话不多说,直接开车,语法如下: { ...
- 2.Mysql集群------Mycat读写分离
前言: Mycat: 一个彻底开源的,面向企业应用开发的大数据库集群 支持事务.ACID.可以替代MySQL的加强版数据库 一个可以视为MySQL集群的企业级数据库,用来替代昂贵的Oracle集群 一 ...
- 14、SpringBoot------定制错误返回内容json格式
开发工具:STS 前言: 在前后端分离的项目中,当前端向后端请求资源失败时,想知道具体的错误原因,给用户予以提示. 但是,在springboot中返回内容是固定的.并不适合我们前端进行分析. 所以,就 ...
- Hibernate 提供session的工具类HibernateUtils
package cn.itcast.utils; import java.sql.Connection; import java.sql.SQLException; import org.hibern ...
- Windows下MySQL数据库的安装与关闭开机自启动
我在学习java,安装数据库时找了很多教程,现在在这里总结一下我安装数据库的过程,我安装的是mysql-5.6.42-winx64版本的. 数据官方下载地址:https://dev.mysql.com ...
- 原生Ajax发送请求
ajax get&post 1.使用get发送请求,会有请求缓存 1)什么叫请求缓存,请求信息相同浏览器不会再向服务器发送请求,导致访问服务器失败. 2)解决:将随机数添加到请求路径后面参数 ...
- springMVC入门一
一.准备工作 eclipse使用maven搭建项目,项目名称为HelloSpringMVC 二.搭建好的项目如下: 项目介绍:实现简单的helloworld 三.具体代码 controller类:He ...