HDOJ2072(map简单应用)(杭电ac100题)
来源:互联网 发布:人民币汇率 知乎 编辑:程序博客网 时间:2024/06/03 11:05
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <math.h>
#include<iostream>
#include <map>
using namespace std;
#define INF 0xfffff;//0x代表十六进制
string s1;
string s2; //捕获s1的单词
map<string, int>m;
int main()
{
while (getline(cin, s1), s1 != "#")
{
s1 += '\''; //以空格判断单词
m.clear();
int l = s1.length(), f;
for (int i = 0; i < l; i++)
{
if (s1[i] >= 'a'&&s1[i] <= 'z')
{
s2 += s1[i];
f = 1;
}
else if (f) //f防止连续空格
{
m[s2]++;
s2.clear();
f=0;
}
}
cout << m.size() << endl;
}
}
#include <cstring>
#include <string>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <math.h>
#include<iostream>
#include <map>
using namespace std;
#define INF 0xfffff;//0x代表十六进制
string s1;
string s2; //捕获s1的单词
map<string, int>m;
int main()
{
while (getline(cin, s1), s1 != "#")
{
s1 += '\''; //以空格判断单词
m.clear();
int l = s1.length(), f;
for (int i = 0; i < l; i++)
{
if (s1[i] >= 'a'&&s1[i] <= 'z')
{
s2 += s1[i];
f = 1;
}
else if (f) //f防止连续空格
{
m[s2]++;
s2.clear();
f=0;
}
}
cout << m.size() << endl;
}
}
阅读全文
0 0
- HDOJ2072(map简单应用)(杭电ac100题)
- hdoj2072 单词数 (set 和 map 两种做法)
- map 杭电 1039
- map容器简单应用
- Google Map 简单应用
- Map简单应用
- 杭电1004 STL map
- 杭电1003 MAP 排序
- 杭电1251(map)
- 杭电 字符串处理 map
- Google Map的简单应用
- zoj 3633 map简单应用
- IOS- Map简单地图应用
- HDU4585Shaolin Map容器简单应用
- C++ map的简单应用
- poj 2153 map简单应用
- goLang map 的简单应用
- 杭电1004(map的应用)之Let the Balloon Rise
- java笔试,面试小程序
- Java常用工具类集合(一)
- android studio更改文件名后缀异常
- 我的第一篇博客~~
- pyspark-Spark编程指南
- HDOJ2072(map简单应用)(杭电ac100题)
- javascript笔记
- ubuntu文件系统修改( for arm)
- 35. Search Insert Position-二分法while版
- IIC多字节读取
- ZXing实现生成不带logo的二维码和带logo的二维码以及扫码功能
- merge
- 乘法逆元求组合数
- 从Paxos到ZooKeeper-一致性协议之Paxos算法