#include <bits/stdc++.h>
using namespace std;
string remove_duplicate_characters(string s) {
if (s.begin() == s.end()) return s;
auto no_dup = s.begin();
for (auto current = no_dup; current != s.end();) {
current = find_if(next(current), s.end(), [no_dup](const char ch) {
return ch != *no_dup;
});
*++no_dup = move(*current);;
}
s.erase(no_dup, s.end());
return s;
}
bool contain_same_characters_and_order(string s1, string s2) {
string s1_tmp = remove_duplicate_characters(s1);
string s2_tmp = remove_duplicate_characters(s2);
return s1_tmp == s2_tmp;
}
int main()
{
string s1 = "c++ programming";
string s2 = "c+++++ ppppprooooogrammingggg";
if (contain_same_characters_and_order(s1, s2))
cout << "yes";
else
cout << "no";
return 0;
}
/*
run:
yes
*/