找到给定字符串的不同字符

找到给定字符串的不同字符_第1张图片

 代码:

#include 
#include
using namespace std;
int main()
{
  string s1,s2;
  cin>>s1>>s2;
  maph;
  for(auto b:s1){
    h[b]++;
  }
  for(auto b:s2){
    h[b]--;
  }
  if(s1.length()>s2.length()) {
    for(auto b:s1){
      if(h[b]==1) cout<

你可能感兴趣的:(c++,算法,开发语言)