#include <iostream>
#include <sstream>
#include <vector>
#include <map>
using namespace std;
void solve_method()
{
string input;
getline(cin, input);
stringstream ss(input);
string s;
vector<string> s_list;
while (getline(ss, s, '@'))
{
s_list.push_back(s);
}
if (s_list.size() != 2)
{
cout << input << endl;
return;
}
vector<string> in_key_order_list;
map<string, int> d_map;
for (int i = 0; i < 2; i++)
{
stringstream curr_ss(s_list[i]);
string item;
while (getline(curr_ss, item, ','))
{
stringstream item_ss(item);
string key, value;
getline(item_ss, key, ':');
getline(item_ss, value, ':');
int int_value = stoi(value);
if(i == 0)
{
d_map[key] = int_value;
in_key_order_list.push_back(key);
}
else
{
d_map[key] -= int_value;
}
}
}
for (int i = 0; i < in_key_order_list.size(); i++)
{
string key = in_key_order_list[i];
int value = d_map[key];
if (value != 0)
{
if (i != in_key_order_list.size() - 1)
{
cout << key << ":" << value << ",";
}
else
{
cout << key << ":" << value << endl;
}
}
}
}
int main()
{
solve_method();
return 0;
}