int uniqueMorseRepresentations(vector<string>& words) {
map<char, string> st;
st.insert(make_pair('a', ".-"));
st.insert(make_pair('b', "-..."));
st.insert(make_pair('c', "-.-."));
st.insert(make_pair('d', "-.."));
st.insert(make_pair('e', "."));
st.insert(make_pair('f', "..-."));
st.insert(make_pair('g', "--.")); st.insert(make_pair('h', "...."));
st.insert(make_pair('i', ".."));
st.insert(make_pair('j', ".---"));
st.insert(make_pair('k', "-.-"));
st.insert(make_pair('l', ".-.."));
st.insert(make_pair('m', "--"));
st.insert(make_pair('n', "-.")); st.insert(make_pair('o', "---"));
st.insert(make_pair('p', ".--."));
st.insert(make_pair('q', "--.-"));
st.insert(make_pair('r', ".-."));
st.insert(make_pair('s', "..."));
st.insert(make_pair('t', "-")); st.insert(make_pair('u', "..-"));
st.insert(make_pair('v', "...-"));
st.insert(make_pair('w', ".--"));
st.insert(make_pair('x', "-..-"));
st.insert(make_pair('y', "-.--"));
st.insert(make_pair('z', "--..")); map<string, int> stt;
int count = ;
for (auto s : words)
{
string str = "";
for (auto c : s)
{
str += st[c];
}
cout << str << endl;
if (stt.find(str) != stt.end())//存在
{ }
else
{
stt.insert(make_pair(str, ));
count++;
}
}
return count;
}

leetcode804的更多相关文章

  1. [Swift]LeetCode804. 唯一摩尔斯密码词 | Unique Morse Code Words

    International Morse Code defines a standard encoding where each letter is mapped to a series of dots ...

  2. LeetCode804. Unique Morse Code Words

    题目 国际摩尔斯密码定义一种标准编码方式,将每个字母对应于一个由一系列点和短线组成的字符串, 比如: "a" 对应 ".-", "b" 对应 ...

  3. Leetcode804.Unique Morse Code Words唯一摩尔斯密码词

    国际摩尔斯密码定义一种标准编码方式,将每个字母对应于一个由一系列点和短线组成的字符串, 比如: "a" 对应 ".-", "b" 对应 &q ...

  4. LeetCode 804 唯一摩尔斯密码词

    package com.lt.datastructure.Set; import java.util.TreeSet; /* * 一个摩斯码,对应一个字母.返回我们可以获得所有词不同单词翻译的数量. ...

随机推荐

  1. maven install时自动施行单元测试

    maven install时自动执行单元测试 1.maven-surefire-plugin简介 Maven本身并不是一个单元测试框架,它只是在构建执行到特定生命周期阶段的时候,通过插件来执行JUni ...

  2. [置顶] Android 关于BottomDialogSheet 与Layout擦出爱的火花?

    今天上班做那个类似于ios拍照的那种效果图 就是个垂直布局然后里面textview+分割线+textview+button 当然也可以用button+分割线+button 方法有很多,选择适合自己的就 ...

  3. Matlab批量读取文件夹文件

    现在有一个文件夹 里面有50个左右的txt文件 每个文件大概三万行 两列 第一列是字符串 第二列是浮点数字 我只需要读第二列 现在我想写一个.M文件 批量读取这个文件夹里的txt文件 读取完以后的数组 ...

  4. Windows下修改hosts并且让他立即生效

    1.打开hosts所在的目录 Win+R->C:\windows\System32\drivers\etc 2.编辑hosts文件 使用Notepad++或者记事本以管理员身份打开hosts,修 ...

  5. OSPF 配置

    封装在IP层:协议号 89 hello时间是dead时间的1/4 224.0.0.5 .在点到点网络, 比如T1线路,是连接单独的一对路由器的网络, 点到点网络上的有效邻居总是可以形成邻接关系的,在这 ...

  6. [qt][问题记录] 无法定位程序输入点 _ZdaPvj 于动态链接库 libstdc++-6.dll

    无法定位程序输入点 _ZdaPvj 于动态链接库 libstdc++-6.dll 该问题是没有打包库的问题,之所以出现这个问题的是直接用系统自带的命令行使用qt的windeployqt命令导致提供的库 ...

  7. 安装g++,在centos上执行yum -y install gcc gcc-c++ libstdc++-devel

    Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile * base: mirrors.1 ...

  8. HDU - 6197:array array array (简单LIS)

    One day, Kaitou Kiddo had stolen a priceless diamond ring. But detective Conan blocked Kiddo's path ...

  9. Navicat for MySQL导入.sql文件

    首先,打开Navicat for MySQL,打开需要使用的连接,新建一个数据库名等按自己的需求填写. 打开创建的数据库,在空白处右键,选择运行SQL文件,然后找到.SQL文件所在地址即可. MySQ ...

  10. 解决Net内存泄露原因

    Net内存泄露原因及解决办法 https://blog.csdn.net/changtianshuiyue/article/details/52443821 什么是.Net内存泄露 (1).NET 应 ...