#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    // ll t;
    // cin>>t;
    // while(t--)
    {
        ll i,j,k,l,m,n;
        string s;
        cin>>s;
        n=s.size();
        if(s[0]=='@'){
          cout<<"No solution";
          return 0;
        }
        ll pos=-2;
        for(i=1;i<n;i++){
            if(s[i]=='@'){
                if(i-pos<=2){
                  cout<<"No solution";
                  return 0;
                }
                pos=i;
            }
        }
        string temp;
        vector<string> anss;
        for(i=0;i<n;i++){
             temp+=s[i];
             if(s[i]=='@'){
                temp+=s[++i];
                anss.push_back(temp);
                //cout<<temp<<'\n';
                temp.clear();
             }
        }
        anss[anss.size()-1]+=temp;
        for(i=0;i<anss.size();i++){
            cout<<anss[i];
            if(i!=anss.size()-1){
              cout<<",";
            }
        }
    }
}


#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    // ll t;
    // cin>>t;
    // while(t--)
    {
        ll i,j,k,l,m,n;
        string s;
        cin>>s;
        n=s.size();
        if(s[0]=='@'||s[n-1]=='@'){
          cout<<"No solution";
          return 0;
        }
        ll pos=-2;
        for(i=1;i<n;i++){
            if(s[i]=='@'){
                if(i-pos<=2){
                  cout<<"No solution";
                  return 0;
                }
                pos=i;
            }
        }
        string temp;
        vector<string> anss;
        for(i=0;i<n;i++){
             temp+=s[i];
             if(s[i]=='@'){
                temp+=s[++i];
                anss.push_back(temp);
                //cout<<temp<<'\n';
                temp.clear();
             }
        }
        if(anss.size()==0){
          cout<<"No solution";
          return 0;
        }
        anss[anss.size()-1]+=temp;
        for(i=0;i<anss.size();i++){
            cout<<anss[i];
            if(i!=anss.size()-1){
              cout<<",";
            }
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	char str[210];
	int ss[210];
	cin>>str;
	int len=strlen(str);
	memset(ss,0,sizeof(ss));
	if(str[0]=='@') cout<<"No solution"<<endl;
	else{
		int flag=0;
		for(int i=1;i<len-1;i++){
			if(str[i]=='@'&&((ss[i-1]!=0||ss[i+1]!=0)||(str[i-1]=='@'||str[i+1]=='@'))){
				flag=1;
				break;
			}
			else if(str[i]=='@'){
				ss[i-1]=1;
				ss[i+1]=1;
			}
		}
		if(flag) cout<<"No solution"<<endl;
		else{
			int i=0;
			while(str[i]!='@'){
				cout<<str[i];
				i++;
			}
			cout<<"@";
			i++;
			for(;i<len;i++){
				if(str[i+1]!='@') cout<<str[i];
				else cout<<","<<str[i];
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	char str[210];
	int ss[210];
	cin>>str;
	int len=strlen(str);
	memset(ss,0,sizeof(ss));
	if(str[0]=='@'||str[len-1]=='@') cout<<"No solution"<<endl;
	else{
		int flag=0;
		int cnt=0;
		for(int i=1;i<len;i++){
			if(str[i]=='@'&&((ss[i-1]!=0||ss[i+1]!=0)||(str[i-1]=='@'||str[i+1]=='@'))){
				flag=1;
				cnt=1;
				break;
			}
			else if(str[i]=='@'){
				ss[i-1]=1;
				ss[i+1]=1;
				cnt=1;
			}
		}
		if(flag) cout<<"No solution"<<endl;
		else{
			if(cnt==0){
				for(int i=0;i<len;i++) cout<<str[i];
			}
			else{
				int i=0;
			while(str[i]!='@'){
				cout<<str[i];
				i++;
			}
			cout<<"@";
			i++;
			for(;i<len;i++){
				if(str[i+1]!='@') cout<<str[i];
				else cout<<","<<str[i];
			}
			}

		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	char str[210];
	int ss[210];
	cin>>str;
	int len=strlen(str);
	memset(ss,0,sizeof(ss));
	if(str[0]=='@') cout<<"No solution"<<endl;
	else{
		int flag=0;
		for(int i=1;i<len-1;i++){
			if(str[i]=='@'&&((ss[i-1]!=0||ss[i+1]!=0)||(str[i-1]=='@'||str[i+1]=='@'))){
				flag=1;
				break;
			}
			else if(str[i]=='@'){
				ss[i-1]=1;
				ss[i+1]=1;
			}
		}
		if(flag) cout<<"No solution"<<endl;
		else{
			for(int i=0;i<len-1;i++){
				if(str[i-1]!='@') cout<<str[i];
				else cout<<str[i]<<",";
			}
			cout<<str[len-1];
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	char str[210];
	int ss[210];
	cin>>str;
	int len=strlen(str);
	memset(ss,0,sizeof(ss));
	if(str[0]=='@'||str[len-1]=='@') cout<<"No solution"<<endl;
	else{
		int flag=0;
		int cnt=0;
		for(int i=1;i<len-1;i++){
			if(str[i]=='@'&&((ss[i-1]!=0||ss[i+1]!=0)||(str[i-1]=='@'||str[i+1]=='@'))){
				flag=1;
				cnt=1;
				break;
			}
			else if(str[i]=='@'){
				ss[i-1]=1;
				ss[i+1]=1;
				cnt=1;
			}
		}
		if(flag) cout<<"No solution"<<endl;
		else{
			if(cnt==0){
				cout<<"No solution"<<endl;
			}
			else{
				int i=0;
			while(str[i]!='@'){
				cout<<str[i];
				i++;
			}
			cout<<"@";
			i++;
			for(;i<len;i++){
				if(str[i+1]!='@') cout<<str[i];
				else cout<<","<<str[i];
			}
			}

		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	char str[210];
	int ss[210];
	cin>>str;
	int len=strlen(str);
	memset(ss,0,sizeof(ss));
	if(str[0]=='@') cout<<"No solution"<<endl;
	else{
		int flag=0;
		int cnt=0;
		for(int i=1;i<len-1;i++){
			if(str[i]=='@'&&((ss[i-1]!=0||ss[i+1]!=0)||(str[i-1]=='@'||str[i+1]=='@'))){
				flag=1;
				cnt=1;
				break;
			}
			else if(str[i]=='@'){
				ss[i-1]=1;
				ss[i+1]=1;
				cnt=1;
			}
		}
		if(flag) cout<<"No solution"<<endl;
		else{
			if(cnt==0){
				for(int i=0;i<len;i++) cout<<str[i];
			}
			else{
				int i=0;
			while(str[i]!='@'){
				cout<<str[i];
				i++;
			}
			cout<<"@";
			i++;
			for(;i<len-1;i++){
				if(str[i+1]!='@') cout<<str[i];
				else cout<<","<<str[i];
			}
			}

		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	char str[210];
	int ss[210];
	cin>>str;
	int len=strlen(str);
	memset(ss,0,sizeof(ss));
	if(str[0]=='@') cout<<"No solution"<<endl;
	else{
		int flag=0;
		int cnt=0;
		for(int i=1;i<len-1;i++){
			if(str[i]=='@'&&((ss[i-1]!=0||ss[i+1]!=0)||(str[i-1]=='@'||str[i+1]=='@'))){
				flag=1;
				cnt=1;
				break;
			}
			else if(str[i]=='@'){
				ss[i-1]=1;
				ss[i+1]=1;
				cnt=1;
			}
		}
		if(flag) cout<<"No solution"<<endl;
		else{
			if(cnt==0){
				for(int i=0;i<len;i++) cout<<str[i];
			}
			else{
				int i=0;
			while(str[i]!='@'){
				cout<<str[i];
				i++;
			}
			cout<<"@";
			i++;
			for(;i<len;i++){
				if(str[i+1]!='@') cout<<str[i];
				else cout<<","<<str[i];
			}
			}

		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	char str[210];
	int ss[210];
	cin>>str;
	int len=strlen(str);
	memset(ss,0,sizeof(ss));
	if(str[0]=='@') cout<<"No solution"<<endl;
	else{
		int flag=0;
		for(int i=1;i<len-1;i++){
			if(str[i]=='@'&&((ss[i-1]!=0||ss[i+1]!=0)||(str[i-1]=='@'||str[i+1]=='@'))){
				flag=1;
				break;
			}
			else if(str[i]=='@'){
				ss[i-1]=1;
				ss[i+1]=1;
			}
		}
		if(flag) cout<<"No solution"<<endl;
		else{
			int i=0;
			while(str[i]!='@'){
				cout<<str[i];
				i++;
			}
			cout<<"@";
			i++;
			for(;i<len-1;i++){
				if(str[i+1]!='@') cout<<str[i];
				else cout<<","<<str[i];
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	char str[210];
	int ss[210];
	cin>>str;
	int len=strlen(str);
	memset(ss,0,sizeof(ss));
	if(str[0]=='@'||str[len-1]=='@') cout<<"No solution"<<endl;
	else{
		int flag=0;
		int cnt=0;
		for(int i=1;i<len-1;i++){
			if(str[i]=='@'&&((ss[i-1]!=0||ss[i+1]!=0)||(str[i-1]=='@'||str[i+1]=='@'))){
				flag=1;
				cnt=1;
				break;
			}
			else if(str[i]=='@'){
				ss[i-1]=1;
				ss[i+1]=1;
				cnt=1;
			}
		}
		if(flag) cout<<"No solution"<<endl;
		else{
			if(cnt==0){
				for(int i=0;i<len;i++) cout<<str[i];
			}
			else{
				int i=0;
			while(str[i]!='@'){
				cout<<str[i];
				i++;
			}
			cout<<"@";
			i++;
			for(;i<len;i++){
				if(str[i+1]!='@') cout<<str[i];
				else cout<<","<<str[i];
			}
			}

		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
   string s;
   cin>>s;
   int n=s.size();
   vector<char> v[n];
   int count=0;
   if(s[0]=='@' || s[n-1]=='@' || n<=2)
   cout<<"No solution";
   else
   {
        for(int i=0;i<n;)
        {
            if(s[i]!='@')
            {
                v[count].push_back(s[i]);
                i++;
            }
            else
            {
                if(i!=n-1)
                {
                    if(s[i+1]=='@' || s[i+2]=='@')
                    {
                        cout<<"No solution";
                        return 0;
                    }
                    else
                    {
                        v[count].push_back(s[i]);
                        v[count].push_back(s[i+1]);
                        count++;
                        i=i+2;
                    }
                }
                else
                v[count].push_back(s[i]);
            }
        }
        for(int i=0;i<n;i++)
        {
            if(v[i].size()>0)
            {
                if(i!=0  && v[i].size()!=0)
                cout<<",";

                for(int j=0;j<v[i].size();j++)
                cout<<v[i][j];
            }
        }
   }

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
   string s;
   cin>>s;
   int n=s.size();
   vector<char> v[n];
   int count=0;
   if(s[0]=='@' || s[n-1]=='@' || n<=2)
   cout<<"No solution";
   else
   {
        for(int i=0;i<n;)
        {
            if(s[i]!='@')
            {
                v[count].push_back(s[i]);
                i++;
            }
            else
            {
                if(i!=n-1)
                {
                    if(s[i+1]=='@' || s[i+2]=='@')
                    {
                        cout<<"No solution";
                        return 0;
                    }
                    else
                    {
                        v[count].push_back(s[i]);
                        v[count].push_back(s[i+1]);
                        count++;
                        i=i+2;
                    }
                }
                else
                v[count].push_back(s[i]);
            }
        }
        for(int i=0;i<n;i++)
        {
            if(v[i].size()>0)
            {
                if(i!=0  && v[i].size()!=0)
                cout<<", ";

                for(int j=0;j<v[i].size();j++)
                cout<<v[i][j];
            }
        }
   }

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
   string s;
   cin>>s;
   int n=s.size();
   int flag=0;
   vector<char> v[n];
   int count=0,x=0;
   for(int i=0;i<n;i++)
   {
       if(s[i]=='@')
       x++;
   }
   if(s[0]=='@' || s[n-1]=='@' || n<=2)
   cout<<"No solution";
   else
   {
        for(int i=0;i<n;)
        {
            if(s[i]!='@')
            {
                v[count].push_back(s[i]);
                i++;
            }
            else
            {
                if(i!=n-1)
                {
                    if(s[i+1]=='@' || s[i+2]=='@')
                    {
                        cout<<"No solution";
                        return 0;
                    }
                    else
                    {
                        v[count].push_back(s[i]);
                        v[count].push_back(s[i+1]);
                        x--;
                        if(x==0)
                        {
                            for(int j=i+2;j<n;j++)
                            v[count].push_back(s[j]);
                            flag=1;
                        }
                        if(flag)
                        break;
                        count++;
                        i=i+2;
                    }
                }
                else
                v[count].push_back(s[i]);
            }
        }
        for(int i=0;i<n;i++)
        {
            if(v[i].size()>0)
            {
                if(i!=0  && v[i].size()!=0)
                cout<<",";

                for(int j=0;j<v[i].size();j++)
                cout<<v[i][j];
            }
        }
   }

}


#include<bits/stdc++.h>
using namespace std;
int main()
{
   string s;
   cin>>s;
   int n=s.size();
   int flag=0;
   vector<char> v[n];
   int count=0,x=0;
   for(int i=0;i<n;i++)
   {
       if(s[i]=='@')
       x++;
   }
   if(x==0)
   cout<<"No solution";
   else if(s[0]=='@' || s[n-1]=='@' || n<=2)
   cout<<"No solution";
   else
   {
        for(int i=0;i<n;)
        {
            if(s[i]!='@')
            {
                v[count].push_back(s[i]);
                i++;
            }
            else
            {
                if(i!=n-1)
                {
                    if(s[i+1]=='@' || s[i+2]=='@')
                    {
                        cout<<"No solution";
                        return 0;
                    }
                    else
                    {
                        v[count].push_back(s[i]);
                        v[count].push_back(s[i+1]);
                        x--;
                        if(x==0)
                        {
                            for(int j=i+2;j<n;j++)
                            v[count].push_back(s[j]);
                            flag=1;
                        }
                        if(flag)
                        break;
                        count++;
                        i=i+2;
                    }
                }
                else
                v[count].push_back(s[i]);
            }
        }
        for(int i=0;i<n;i++)
        {
            if(v[i].size()>0)
            {
                if(i!=0  && v[i].size()!=0)
                cout<<",";

                for(int j=0;j<v[i].size();j++)
                cout<<v[i][j];
            }
        }
   }

}


#include<bits/stdc++.h>
using namespace std;

int main()
{
   string str;
   cin>>str;
   vector<string>v;
   int pos=-1;
   string str2="";
   for(int i=0;i<str.size();i++)
   {
             if((i==0 ||i==str.size()-1)&&str[i]=='@')
             {
                cout<<"No solution"<<endl;
                return 0;
             }
            else if(i+1<=str.size()-1&&str[i]=='@'&&str[i+1]!='@')
            {str2=str2+str[i];
              str2=str2+str[i+1];
              if(str2[0]=='@'||str2[str.size()-1]=='@')
              {
                cout<<"No solution"<<endl;
                return 0;
              }
              v.push_back(str2);
              str2="";
              i=i+1;

            }
            else if(i+1<=str.size()-1&&str[i]=='@'&&str[i+1]=='@')
            {
                cout<<"No solution"<<endl;
                return 0;
            }
            else
            str2=str2+str[i];

   }
   if(v.size()>=1)
   v[v.size()-1]=v[v.size()-1]+str2;
   for(int i=0;i<v.size();i++)
   {
    if(i!=v.size()-1)
    cout<<v[i]<<",";
  else
    cout<<v[i];
   }
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
   string str;
   cin>>str;
   vector<string>v;
   int pos=-1;
   string str2="";
   int flag=0;
   for(int i=0;i<str.size();i++)
   {
             if((i==0 ||i==str.size()-1)&&str[i]=='@')
             {
                cout<<"No solution"<<endl;
                return 0;
             }
            else if(i+1<=str.size()-1&&str[i]=='@'&&str[i+1]!='@')
            {str2=str2+str[i];
              str2=str2+str[i+1];
              flag=1;
              if(str2[0]=='@'||str2[str.size()-1]=='@')
              {
                cout<<"No solution"<<endl;
                return 0;
              }
              v.push_back(str2);
              str2="";
              i=i+1;

            }
            else if(i+1<=str.size()-1&&str[i]=='@'&&str[i+1]=='@')
            {
                cout<<"No solution"<<endl;
                return 0;
            }
            else
            str2=str2+str[i];

   }
   if(flag==0)
   {
    cout<<"No solution"<<endl;
                return 0;
   }
   if(v.size()>=1)
   v[v.size()-1]=v[v.size()-1]+str2;
   for(int i=0;i<v.size();i++)
   {
    if(i!=v.size()-1)
    cout<<v[i]<<",";
  else
    cout<<v[i];
   }
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
   string str;
   cin>>str;
   vector<string>v;
   int pos=-1;
   string str2="";
   for(int i=0;i<str.size();i++)
   {
             if((i==0 ||i==str.size()-1)&&str[i]=='@')
             {
                cout<<"No solution"<<endl;
                return 0;
             }
            else if(i+1<=str.size()-1&&str[i]=='@'&&str[i+1]!='@')
            {str2=str2+str[i];
              str2=str2+str[i+1];
              if(str2[0]=='@'||str2[str.size()-1]=='@')
              {
                cout<<"No solution"<<endl;
                return 0;
              }
              v.push_back(str2);
              str2="";
              i=i+1;

            }
            else if(i+1<=str.size()-1&&str[i]=='@'&&str[i+1]=='@')
            {
                cout<<"No solution"<<endl;
                return 0;
            }
            else
            str2=str2+str[i];

   }
   for(int i=0;i<v.size();i++)
   {
    if(i!=v.size()-1)
    cout<<v[i]<<",";
  else
    cout<<v[i];
   }
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
   string str;
   cin>>str;
   vector<string>v;
   int pos=-1;
   string str2="";
   for(int i=0;i<str.size();i++)
   {
             if((i==0 ||i==str.size()-1)&&str[i]=='@')
             {
                cout<<"No solution"<<endl;
                return 0;
             }
            else if(i+1<=str.size()-1&&str[i]=='@'&&str[i+1]!='@')
            {str2=str2+str[i];
              str2=str2+str[i+1];
              if(str2[0]=='@')
              {
                cout<<"No solution"<<endl;
                return 0;
              }
              v.push_back(str2);
              str2="";
              i=i+1;

            }
            else if(i+1<=str.size()-1&&str[i]=='@'&&str[i+1]=='@')
            {
                cout<<"No solution"<<endl;
                return 0;
            }
            else
            str2=str2+str[i];

   }
   for(int i=0;i<v.size();i++)
   {
    if(i!=v.size()-1)
    cout<<v[i]<<",";
  else
    cout<<v[i];
   }
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
   string str;
   cin>>str;
   vector<string>v;
   int pos=-1;
   string str2="";
   for(int i=0;i<str.size();i++)
   {
             if((i==0 ||i==str.size()-1)&&str[i]=='@')
             {
                cout<<"No solution"<<endl;
                return 0;
             }
            else if(i+1<=str.size()-1&&str[i]=='@'&&str[i+1]!='@')
            {str2=str2+str[i];
              str2=str2+str[i+1];
              if(str2[0]=='@'||str2[str.size()-1]=='@')
              {
                cout<<"No solution"<<endl;
                return 0;
              }
              v.push_back(str2);
              str2="";
              i=i+1;

            }
            else if(i+1<=str.size()-1&&str[i]=='@'&&str[i+1]=='@')
            {
                cout<<"No solution"<<endl;
                return 0;
            }
            else
            str2=str2+str[i];

   }
   v[v.size()-1]=v[v.size()-1]+str2;
   for(int i=0;i<v.size();i++)
   {
    if(i!=v.size()-1)
    cout<<v[i]<<",";
  else
    cout<<v[i];
   }
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
   string str;
   cin>>str;
   vector<string>v;
   int pos=-1;
   string str2="";
   int flag=0;
   for(int i=0;i<str.size();i++)
   {
             if((i==0 ||i==str.size()-1)&&str[i]=='@')
             {
                cout<<"No solution"<<endl;
                return 0;
             }
            else if(i+1<=str.size()-1&&str[i]=='@'&&str[i+1]!='@')
            {str2=str2+str[i];
              str2=str2+str[i+1];
              flag=1;
              if(str2[0]=='@'||str2[str2.size()-1]=='@')
              {
                cout<<"No solution"<<endl;
                return 0;
              }
              v.push_back(str2);
              str2="";
              i=i+1;

            }
            else if(i+1<=str.size()-1&&str[i]=='@'&&str[i+1]=='@')
            {
                cout<<"No solution"<<endl;
                return 0;
            }
            else
            str2=str2+str[i];

   }
   if(flag==0)
   {
    cout<<"No solution"<<endl;
                return 0;
   }
   if(v.size()>=1)
   v[v.size()-1]=v[v.size()-1]+str2;
   for(int i=0;i<v.size();i++)
   {
    if(i!=v.size()-1)
    cout<<v[i]<<",";
  else
    cout<<v[i];
   }
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
	string s, a = "";
	cin>>s;
	int i = 0, cnt = 0;
	vi pre(sz(s), 0);
	if(s[sz(s)-1]=='@')pre[sz(s)-1]=1;
	for(int i = sz(s)-2; i >= 0; i--){
		pre[i]=pre[i+1];
		if(s[i]=='@')pre[i]=pre[i+1]+1;
	}
	if(*max_element(all(pre))==0){
		cout<<"No solution\n";
		return;
	}
	while(i<sz(s))
	{
		if(a[sz(a)-1]=='@'){
			if(s[i]!='@')a+=s[i];
			if(pre[i]&&i<sz(s)-1){
				a+=',';
				if(s[i]=='@')a+=s[i];
			}
		}
		else a+=s[i];
		i++;
	}
	for(int i = 0; i < sz(a); i++){
		if(a[i]=='@'&&i==0){
			cout<<"No solution";
			return;
		}
		if(a[i]=='@'&&i==sz(a)-1){
			cout<<"No solution";
			return;
		}
		if(a[i]=='@'&&i>0){
			if(a[i-1]==','){
				cout<<"No solution";
				return;
			}
		}
	}
	cout<<a;
}
signed main(){
	speed;
	int t=1;
	//cin>>t;
	while(t--)solve();
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
	string s, a = "";
	cin>>s;
	int i = 0, cnt = 0;
	for(int i = 0; i < sz(s); i++)cnt+=(s[i]=='@');
	while(i<sz(s))
	{
		if(a[sz(a)-1]=='@'){
			a+=s[i];
			if(i<sz(s)-1)a+=',';
		}
		else a+=s[i];
		i++;
	}
	for(int i = 0; i < sz(a); i++){
		if(a[i]=='@'&&i==0){
			cout<<"No solution";
			return;
		}
		if(a[i]=='@'&&i==sz(a)-1){
			cout<<"No solution";
			return;
		}
		if(a[i]=='@'&&i>0){
			if(a[i-1]==','){
				cout<<"No solution";
				return;
			}
		}
	}
	cout<<a;
}
signed main(){
	speed;
	int t=1;
	//cin>>t;
	while(t--)solve();
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
	string s, a = "";
	cin>>s;
	int i = 0, cnt = 0;
	vi pre(sz(s), 0);
	if(s[sz(s)-1]=='@')pre[sz(s)-1]=1;
	for(int i = sz(s)-2; i >= 0; i--){
		pre[i]=pre[i+1];
		if(s[i]=='@')pre[i]=pre[i+1]+1;
	}
	if(*max_element(all(pre))==0){
		cout<<"No solution\n";
		return;
	}
	while(i<sz(s))
	{
		if(a[sz(a)-1]=='@'){
			a+=s[i];
			if(pre[i+1]&&i<sz(s)-1)a+=',';
		}
		else a+=s[i];
		i++;
	}
	for(int i = 0; i < sz(a); i++){
		if(a[i]=='@'&&i==0){
			cout<<"No solution";
			return;
		}
		if(a[i]=='@'&&i==sz(a)-1){
			cout<<"No solution";
			return;
		}
		if(a[i]=='@'&&i>0){
			if(a[i-1]==','){
				cout<<"No solution";
				return;
			}
		}
	}
	cout<<a;
}
signed main(){
	speed;
	int t=1;
	//cin>>t;
	while(t--)solve();
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
	string s, a = "";
	cin>>s;
	int i = 0, cnt = 0;
	vi pre(sz(s), 0);
	if(s[sz(s)-1]=='@')pre[sz(s)-1]=1;
	for(int i = sz(s)-2; i >= 0; i--){
		pre[i]=pre[i+1];
		if(s[i]=='@')pre[i]=pre[i+1]+1;
	}
	while(i<sz(s))
	{
		if(a[sz(a)-1]=='@'){
			a+=s[i];
			if(pre[i+1]&&i<sz(s)-1)a+=',';
		}
		else a+=s[i];
		i++;
	}
	for(int i = 0; i < sz(a); i++){
		if(a[i]=='@'&&i==0){
			cout<<"No solution";
			return;
		}
		if(a[i]=='@'&&i==sz(a)-1){
			cout<<"No solution";
			return;
		}
		if(a[i]=='@'&&i>0){
			if(a[i-1]==','){
				cout<<"No solution";
				return;
			}
		}
	}
	cout<<a;
}
signed main(){
	speed;
	int t=1;
	//cin>>t;
	while(t--)solve();
}


#include <iostream>
#include <string>
#include<cstring>
#include <algorithm>

using namespace std;

int main()
{
    int l,p=1,n=0;
    string s;
    getline(cin,s);
    l=s.size();
    if(l<3)
    {
        cout<<"No solution";
                return 0;
    }
    for(int i=0;i<l;i++)
    {if(s[i]=='@')
        {if(i==0||i==l-1){cout<<"No solution";return 0;}
        if((s[i]==s[i+1])||(s[i]==s[i+2]))
        {cout<<"No solution";
                return 0;}n++;}}
    for(int i=0;i<l;i++)
    {cout<<s[i];
    if((s[i-1]=='@')&&(p<n)&&(i>0))
    {cout<<",";p++;}
    }
}


#include <iostream>
#include <string>
#include<cstring>
#include <algorithm>

using namespace std;

int main()
{
    int l,p=1,n=0;
    string s;
    getline(cin,s);
    l=s.size();
    for(int i=0;i<l;i++)
    {if(s[i]=='@')
        {if(i==0||i==l-1){cout<<"No solution";return 0;}
        if((s[i]==s[i+1])||(s[i]==s[i+2]))
        {cout<<"No solution";
                return 0;}n++;}}
    for(int i=0;i<l;i++)
    {cout<<s[i];
    if((s[i-1]=='@')&&(p<n)&&(i>0))
    {cout<<",";p++;}
    }
}


#include <iostream>
#include <string>
#include<cstring>
#include <algorithm>

using namespace std;

int main()
{
    int l,p=1,n=0;
    string s;
    getline(cin,s);
    l=s.size();
    if(l<3)
    {
        cout<<"No solution";
                return 0;
    }
    for(int i=0;i<l;i++)
    {if(s[i]=='@')
        {if(i==0||i==l-1){cout<<"No solution";return 0;}
        if((s[i]==s[i+1])||(s[i]==s[i+2]))
        {cout<<"No solution";
                return 0;}n++;}}
    if(n==0)
    {cout<<"No solution";
                return 0;

    }
    for(int i=0;i<l;i++)
    {cout<<s[i];
    if((s[i-1]=='@')&&(p<n)&&(i>0))
    {cout<<",";p++;}
    }
}


#include <iostream>
#include <string>
#include<cstring>
#include <algorithm>

using namespace std;

int main()
{
    int l,p,n;
    string s;
    getline(cin,s);
    l=s.size();
    if((l%3)==0)
    {for(int i=0;i<l;i++)
    {if((s[i]=='@')&&(((i-1)%3)!=0))
        {
                cout<<"No solution";
                return 0;}}
    for(int i=0;i<l;i++)
    {if((i%3==0)&&(i!=0)&&(i!=l))
    {
        cout<<",";}
    cout<<s[i];}
    }
    if((l%3)!=0)
    {
        cout<<"No solution";
    return 0;}

}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;

const int MAX_N = 44;
const int ALPH_SIZE = 26;
const double EPS = 1e-6;

int n;
string s;
int last_sob_pos = -1;
vector<string> ans;

void read() {
	cin >> s;
	n = s.length();
	for (int i = 0; i < n; i++) {
		if (s[i] == '@') {
			last_sob_pos = i;
		}
	}
}

void solve() {
	if (s[0] == '@' || s[n - 1] == '@' || last_sob_pos == -1) {
		cout << "No solution\n";
		return;
	}

	string w = "";
	int i = 0;
	while (i < s.length()) {
		if (s[i] == '@' && s[i + 1] == '@' ||
			s[i] == '@' && w == "") {
			cout << "No solution\n";
			return;
		}
		w += s[i];
		if (i == last_sob_pos) {
			i++;
		}
		else if (s[i] == '@') {
			w += s[i + 1];
			ans.push_back(w);
			w = "";
			i += 2;
		}
		else {
			i++;
		}
	}
	if (w != "")
		ans.push_back(w);

	string res = "";
	for (int i = 0; i < ans.size(); i++) {
		res += ans[i];
		if (i < ans.size() - 1) {
			res += ",";
		}
	}
	cout << res << endl;
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

	read();
	solve();

	return 0;
}


//1194B
//Yet Another Crosses Problem
#include<bits/stdc++.h>
using namespace std;

int main()
{
	long q;
	long n,m,i,j;
	char c;

	cin>>q;

	while(q--)
	{
	cin>>n;
	cin>>m;
	int arr[n][m];
	for(i=0;i<n;i++)
		for(j=0;j<m;j++)
		{
			cin>>c;

			if(c=='.')
				arr[i][j]=0;
			else
				arr[i][j]=1;
		}

	long row=n,column=m,min_row=0;
	long count=0;
	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			if(arr[i][j]==0)
				count++;
		}
		if(count<row)
		{
			row=count;
			min_row=i;
		}
		count=0;
	}

	for(j=0;j<m;j++)
		if(arr[min_row][j]==0)
			arr[min_row][j]=1;

	count=0;
	for(j=0;j<m;j++)
	{
		for(i=0;i<n;i++)
		{
			if(arr[i][j]==0)
				count++;
		}
		if(count<column)
			column=count;
		count=0;
	}
	cout<<(row+column)<<endl<<endl;
	}

	return 0;
}


//1194B
//Yet Another Crosses Problem
#include<bits/stdc++.h>
using namespace std;

void cross(int q)
{
	int arr[50000][50000];
	int n,m,i,j;
	char c;

	while(q--)
	{
	cin>>n;
	cin>>m;
	for(i=0;i<n;i++)
		for(j=0;j<m;j++)
		{
			cin>>c;

			if(c=='.')
				arr[i][j]=0;
			else if(c=='*')
				arr[i][j]=1;
		}

	int row=n,column=m,min_row=0,min_column=0;
	int count=0;
	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			if(arr[i][j]==0)
				count++;
		}
		if(count<row)
		{
			row=count;
			min_row=i;
		}
		count=0;
	}

	count=0;
	for(j=0;j<m;j++)
	{
		for(i=0;i<n;i++)
		{
			if(arr[i][j]==0)
				count++;
		}
		if(count<column)
		{
			column=count;
			min_column=j;
		}
		count=0;
	}
	cout<<(row+column-(arr[min_row][min_column]==0))<<endl<<endl;
	}
}

int main()
{
	int q;

	cin>>q;

	cross(q);

	return 0;
}


//1194B
//Yet Another Crosses Problem
#include<bits/stdc++.h>
using namespace std;

int main()
{
	int q;
	int n,m,i,j;
	char c;

	cin>>q;

	while(q--)
	{
	cin>>n;
	cin>>m;
	unsigned int arr[n][m];
	for(i=0;i<n;i++)
		for(j=0;j<m;j++)
		{
			cin>>c;

			if(c=='.')
				arr[i][j]=0;
			else
				arr[i][j]=1;
		}

	int row=n,column=m,min_row=0,min_column=0;
	int count=0;
	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			if(arr[i][j]==0)
				count++;
		}
		if(count<row)
		{
			row=count;
			min_row=i;
		}
		count=0;
	}

	count=0;
	for(j=0;j<m;j++)
	{
		for(i=0;i<n;i++)
		{
			if(arr[i][j]==0)
				count++;
		}
		if(count<column)
		{
			column=count;
			min_column=j;
		}
		count=0;
	}
	cout<<(row+column-(arr[min_row][min_column]==0))<<endl<<endl;
	}

	return 0;
}


//1194B
//Yet Another Crosses Problem
#include<bits/stdc++.h>
using namespace std;

int main()
{
	int q;
	int n,m,i,j;
	char c;

	cin>>q;

	while(q--)
	{
	cin>>n;
	cin>>m;
	unsigned int arr[n][m];
	for(i=0;i<n;i++)
		for(j=0;j<m;j++)
		{
			cin>>c;

			if(c=='.')
				arr[i][j]=0;
			else if(c=='*')
				arr[i][j]=1;
		}

	int row=n,column=m,min_row=0,min_column=0;
	int count=0;
	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			if(arr[i][j]==0)
				count++;
		}
		if(count<row)
		{
			row=count;
			min_row=i;
		}
		count=0;
	}

	count=0;
	for(j=0;j<m;j++)
	{
		for(i=0;i<n;i++)
		{
			if(arr[i][j]==0)
				count++;
		}
		if(count<column)
		{
			column=count;
			min_column=j;
		}
		count=0;
	}
	cout<<(row+column-(arr[min_row][min_column]==0))<<endl<<endl;
	}

	return 0;
}


		#include<bits/stdc++.h>
		using namespace std;
		long long q;
		char c[400005];
		long long a[100005],b[100005];
		int main()
		{
			ios::sync_with_stdio(false);
		    cin>>q;
		    while(q--)
		    {
		      memset(a,0,sizeof(a));
		      memset(b,0,sizeof(b));
		      long long n,m;
		      cin>>n>>m;
		      for(int i=0;i<n;i++)
		      {
		         for(int j=0;j<m;j++)
		         {
		            cin>>c[i*m+j];
		            if(c[i*m+j]=='*')
		            {
		              a[i]++;
		              b[j]++;
		            }
		         }
		      }
		      long long num=99999;
		      for(int i=0;i<n;i++)
		      {
		       for(int j=0;j<m;j++)
		       {
		         num=min(num,n+m-a[i]-b[j]-(c[i*m+j]=='*'?0:1));
		       }
		      }
		      cout<<num<<"\n";
			  }
		    return 0;
		}


#include<bits/stdc++.h>
using namespace std;
long long q;
char c[400005];
long long a[400005],b[400005],d[400005];
int main()
{
    cin>>q;
    while(q--)
    {
      memset(a,0,sizeof(a));
      memset(b,0,sizeof(b));
      long long n,m;
      cin>>n>>m;
      for(int i=0;i<n;i++)
      {
         for(int j=0;j<m;j++)
         {
            cin>>c[i*m+j];
            if(c[i*m+j]=='*')
            {
              a[i]++;
              b[j]++;
            }
         }
      }
      long long num=9999999;
      for(int i=0;i<n;i++)
      {
       for(int j=0;j<m;j++)
       {
          if(c[i*m+j]=='*')d[i*m+j]=n+m-a[i]-b[j];
          else d[i*m+j]=n+m-a[i]-b[j]-1;
          if(d[i*m+j]<num)num=d[i*m+j];
       }
      }
      cout<<num<<endl;
	  }
    return 0;
}


	#include<bits/stdc++.h>
	using namespace std;
	long long q;
	char c[400005];
	long long a[400005],b[400005],d[400005];
	int main()
	{
	    cin>>q;
	    while(q--)
	    {
	      memset(a,0,sizeof(a));
	      memset(b,0,sizeof(b));
	      long long n,m;
	      cin>>n>>m;
	      for(int i=0;i<n;i++)
	      {
	         for(int j=0;j<m;j++)
	         {
	            cin>>c[i*m+j];
	            if(c[i*m+j]=='*')
	            {
	              a[i]++;
	              b[j]++;
	            }
	         }
	      }
	      long long num=99999;
	      for(int i=0;i<n;i++)
	      {
	       for(int j=0;j<m;j++)
	       {
	          if(c[i*m+j]=='*')d[i*m+j]=n+m-a[i]-b[j];
	          else d[i*m+j]=n+m-a[i]-b[j]-1;
	          if(d[i*m+j]<num)num=d[i*m+j];
	       }
	      }
	      cout<<num<<"\n";
		  }
	    return 0;
	}


	#include<bits/stdc++.h>
	using namespace std;
	long long q;
	char c[400005];
	long long a[400005],b[400005],d[400005];
	int main()
	{
	    cin>>q;
	    while(q--)
	    {
	      memset(a,0,sizeof(a));
	      memset(b,0,sizeof(b));
	      long long n,m;
	      cin>>n>>m;
	      for(int i=0;i<n;i++)
	      {
	         for(int j=0;j<m;j++)
	         {
	            cin>>c[i*m+j];
	            if(c[i*m+j]=='*')
	            {
	              a[i]++;
	              b[j]++;
	            }
	         }
	      }
	      long long num=9999999;
	      for(int i=0;i<n;i++)
	      {
	       for(int j=0;j<m;j++)
	       {
	          if(c[i*m+j]=='*')d[i*m+j]=n+m-a[i]-b[j];
	          else d[i*m+j]=n+m-a[i]-b[j]-1;
	          if(d[i*m+j]<num)num=d[i*m+j];
	       }
	      }
	      cout<<num<<'\n';
		  }
	    return 0;
	}


		#include<bits/stdc++.h>
		using namespace std;
		long long q;
		char c[400005];
		long long a[50004],b[50005];
		int main()
		{
			ios::sync_with_stdio(false);
		    cin>>q;
		    while(q--)
		    {
		      memset(a,0,sizeof(a));
		      memset(b,0,sizeof(b));
		      long long n,m;
		      cin>>n>>m;
		      for(int i=0;i<n;i++)
		      {
		         for(int j=0;j<m;j++)
		         {
		            cin>>c[i*m+j];
		            if(c[i*m+j]=='*')
		            {
		              a[i]++;
		              b[j]++;
		            }
		         }
		      }
		      long long num=99999;
		      for(int i=0;i<n;i++)
		      {
		       for(int j=0;j<m;j++)
		       {
		         num=min(num,n+m-a[i]-b[j]-(c[i*m+j]=='*'?0:1));
		       }
		      }
		      cout<<num<<"\n";
			  }
		    return 0;
		}


#include<bits/stdc++.h>
using namespace std;
long long q;
char c[400005];
long long a[400005],b[400005],d[400005];
int main()
{
    cin>>q;
    while(q--)
    {
      memset(a,0,sizeof(a));
      memset(b,0,sizeof(b));
      long long n,m;
      cin>>n>>m;
      for(int i=0;i<n;i++)
      {
         for(int j=0;j<m;j++)
         {
            cin>>c[i*m+j];
            if(c[i*m+j]=='*')
            {
              a[i]++;
              b[j]++;
            }
         }
      }
      long long num=9999999;
      for(int i=0;i<n;i++)
      {
       for(int j=0;j<m;j++)
       {
          if(c[i*m+j]=='*')d[i*m+j]==8-a[i]-b[j];
          else d[i*m+j]=8-a[i]-b[j]-1;
          if(d[i*m+j]<num)num=d[i*m+j];
       }
      }
      cout<<num<<endl;
	  }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long q;
char c[400005];
long long a[400005],b[400005],d[400005];
int main()
{
    cin>>q;
    while(q--)
    {
      memset(a,0,sizeof(a));
      memset(b,0,sizeof(b));
      long long n,m;
      cin>>n>>m;
      for(int i=0;i<n;i++)
      {
         for(int j=0;j<m;j++)
         {
            cin>>c[i*m+j];
            if(c[i*m+j]=='*')
            {
              a[i]++;
              b[j]++;
            }
         }
      }
      long long num=9999999;
      for(int i=0;i<n;i++)
      {
       for(int j=0;j<m;j++)
       {
          if(c[i*m+j]=='*')d[i*m+j]=n+m-a[i]-b[j];
          else d[i*m+j]=n+m-a[i]-b[j];
          if(d[i*m+j]<num)num=d[i*m+j];
       }
      }
      cout<<num<<endl;
	  }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int q;
    cin>>q;
    int n,m;
    int i,j,temp,x;
    while(q--){
        cin>>n>>m;
        char arr[n][m];
        for(i=0;i<n;i++)
            for(j=0;j<m;j++)
                cin>>arr[i][j];

        vector<int>r(n,0);
        vector<int>c(m,0);
        for(i=0;i<n;i++){
            for(j=0;j<m;j++){
                if(arr[i][j]=='.'){
                    r[i]++;
                    c[j]++;
                }
            }
        }
        temp=n+m;
        for(i=0;i<n;i++){
            for(j=0;j<m;j++){
                temp=min(temp,r[i]+c[j]-(arr[i][j]=='.'?1:0));
            }
        }
        cout<<temp<<"\n";
    }

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long q;
char c[400005];
long long a[400005],b[400005],d[400005];
int main()
{
    cin>>q;
    while(q--)
    {
      memset(a,0,sizeof(a));
      memset(b,0,sizeof(b));
      long long n,m;
      cin>>n>>m;
      for(int i=0;i<n;i++)
      {
         for(int j=0;j<m;j++)
         {
            cin>>c[i*m+j];
            if(c[i*m+j]=='*')
            {
              a[i]++;
              b[j]++;
            }
         }
      }
      long long num=9999999;
      for(int i=0;i<n;i++)
      {
       for(int j=0;j<m;j++)
       {
          if(c[i*m+j]=='*')d[i*m+j]==n+m-a[i]-b[j];
          else d[i*m+j]=n+m-a[i]-b[j];
          if(d[i*m+j]<num)num=d[i*m+j];
       }
      }
      cout<<num<<endl;
	  }
    return 0;
}


	#include<bits/stdc++.h>
	using namespace std;
	long long q;
	char c[400005];
	long long a[400005],b[400005];
	int main()
	{
		ios::sync_with_stdio(false);
	    cin>>q;
	    while(q--)
	    {
	      memset(a,0,sizeof(a));
	      memset(b,0,sizeof(b));
	      long long n,m;
	      cin>>n>>m;
	      for(int i=0;i<n;i++)
	      {
	         for(int j=0;j<m;j++)
	         {
	            cin>>c[i*m+j];
	            if(c[i*m+j]=='*')
	            {
	              a[i]++;
	              b[j]++;
	            }
	         }
	      }
	      long long num=99999;
	      for(int i=0;i<n;i++)
	      {
	       for(int j=0;j<m;j++)
	       {
	         num=min(num,n+m-a[i]-b[j]-(c[i*m+j]=='*'?0:1));
	       }
	      }
	      cout<<num<<"\n";
		  }
	    return 0;
	}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <random>
#include <complex>

#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define reset(x, y) memset(x, y, sizeof(x))
#define BUG(x) cerr << #x << " = " << (x) << endl
#define BUGP(x) cout << #x << " = " << (x)._1 << ", " << (x)._2 << endl
int const INF = (int) 1e9 + 1e3;
long long const INFL = (long long) 1e18 + 1e6;
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

const int dr[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dc[] = {0, -1, 0, 1, -1, 1, -1, 1};

// Head
int main() {
    int q;
    cin >> q;

    string str[50000 + 5];
    while (q--) {
        int r, c, dotr[50000+5]={0},dotc[50000+5] = {0};
        cin >> r >> c;
        for (int i = 0; i < r; ++i) {
            cin >> str[i];
            for (int j = 0; j < str[i].size(); ++j) {
                if(str[i][j]=='.') dotr[i]++;
            }
        }
        for (int i = 0; i < c; ++i) {
            for (int j = 0; j < r; ++j) {
                if(str[j][i]=='.') dotc[i] ++;
            }
        }
        int ans = 1e9;
        for (int i = 0; i < r; ++i) {
            for (int j = 0; j < c; ++j) {
               ans = min (ans, dotr[i]+dotc[j]+ (str[i][j] == '.'? -1 :0)  );
            }
        }
        cout<< ans << '\n';
    }
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <random>
#include <complex>

#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define reset(x, y) memset(x, y, sizeof(x))
#define BUG(x) cerr << #x << " = " << (x) << endl
#define BUGP(x) cout << #x << " = " << (x)._1 << ", " << (x)._2 << endl
int const INF = (int) 1e9 + 1e3;
long long const INFL = (long long) 1e18 + 1e6;
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

const int dr[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dc[] = {0, -1, 0, 1, -1, 1, -1, 1};

// Head
int main() {
    int q;
    cin >> q;

    string str[50000 + 5];
    while (q--) {
        int r, c, maxr = 0, maxc = 0;
        cin >> r >> c;
        int maxx =0;
        for (int i = 0; i < r; ++i) {
            cin >> str[i];
            int star = 0;
            for (auto it: str[i]) {
                if (it == '*') star++;
            }
            if (star > maxx) {
                maxx =star;
                maxr = i;
            }
        }
        maxx =0;
        for (int i = 0; i < c; ++i) {
            int star = 0;
            for (int j = 0; j < r; j++) {
                if (str[j][i] == '*') star++;
            }
            if ( star > maxx) {
                maxx =star;
                    maxc = i;
            } else if(star == maxx && i != maxr) maxc = i;
        }
        int ans=0, i = max(r,c);
//        cout << maxr << " " << maxc << endl;
        while(i--){
            if(i!=maxr) if(i < r)if(str[i][maxc] =='.')ans++;
            if(i < c)if(str[maxr][i] =='.')ans++;
        }

        cout <<ans<< '\n';
    }
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <random>
#include <complex>

#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define reset(x, y) memset(x, y, sizeof(x))
#define BUG(x) cerr << #x << " = " << (x) << endl
#define BUGP(x) cout << #x << " = " << (x)._1 << ", " << (x)._2 << endl
int const INF = (int) 1e9 + 1e3;
long long const INFL = (long long) 1e18 + 1e6;
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

const int dr[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dc[] = {0, -1, 0, 1, -1, 1, -1, 1};

// Head
int main() {
    int q;
    cin >> q;

    string str[50000 + 5];
    while (q--) {
        int r, c, maxr = 0, maxc = 0;
        cin >> r >> c;
        int maxx =0;
        for (int i = 0; i < r; ++i) {
            cin >> str[i];
            int star = 0;
            for (auto it: str[i]) {
                if (it == '*') star++;
            }
            if (star > maxx) {
                maxx =star;
                maxr = i;
            }
        }
        maxx =0;
        for (int i = 0; i < c; ++i) {
            int star = 0;
            for (int j = 0; j < r; j++) {

                if (str[j][i] == '*') {
                    star++;
                    if(j== maxr) star--;
                }

            }
            if ( star > maxx) {
                maxx =star;
                    maxc = i;
            }
        }
        int ans=0, i = max(r,c);
        cout << maxr << " " << maxc << endl;
        while(i--){
            if(i!=maxr) if(i < r)if(str[i][maxc] =='.')ans++;
            if(i < c)if(str[maxr][i] =='.')ans++;
        }

        cout <<ans<< '\n';
    }
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <random>
#include <complex>

#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define reset(x, y) memset(x, y, sizeof(x))
#define BUG(x) cerr << #x << " = " << (x) << endl
#define BUGP(x) cout << #x << " = " << (x)._1 << ", " << (x)._2 << endl
int const INF = (int) 1e9 + 1e3;
long long const INFL = (long long) 1e18 + 1e6;
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

const int dr[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dc[] = {0, -1, 0, 1, -1, 1, -1, 1};

// Head
int main() {
    int q;
    cin >> q;

    string str[50000 + 5];
    while (q--) {
        int r, c, maxr = 0, maxc = 0;
        cin >> r >> c;
        for (int i = 0; i < r; ++i) {
            cin >> str[i];
            int star = 0;
            for (auto it: str[i]) {
                if (it == '*') star++;
            }
            if (star > maxr) maxr = star;
        }

        for (int i = 0; i < c; ++i) {
            int star = 0;
            for (int j = 0; j < r; j++) {
                if (str[j][i] == '*') star++;
            }
            if (star > maxc) maxc = star;
        }

        cout << r+c-maxc -maxr<< '\n';
    }
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <random>
#include <complex>

#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define reset(x, y) memset(x, y, sizeof(x))
#define BUG(x) cerr << #x << " = " << (x) << endl
#define BUGP(x) cout << #x << " = " << (x)._1 << ", " << (x)._2 << endl
int const INF = (int) 1e9 + 1e3;
long long const INFL = (long long) 1e18 + 1e6;
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

const int dr[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dc[] = {0, -1, 0, 1, -1, 1, -1, 1};

// Head
int main() {
    int q;
    cin >> q;

    string str[50000 + 5];
    while (q--) {
        int r, c, maxr = 0, maxc = 0;
        cin >> r >> c;
        int maxx =0;
        for (int i = 0; i < r; ++i) {
            cin >> str[i];
            int star = 0;
            for (auto it: str[i]) {
                if (it == '*') star++;
            }
            if (star > maxx) {
                maxx =star;
                maxr = i;
            }
        }
        maxx =0;
        for (int i = 0; i < c; ++i) {
            int star = 0;
            for (int j = 0; j < r; j++) {
                if(j== maxr) continue;
                if (str[j][i] == '*') star++;
            }
            if ( star > maxx) {
                maxx =star;
                    maxc = i;
            }
        }
        int ans=0, i = max(r,c);
//        cout << maxr << " " << maxc << endl;
        while(i--){
            if(i!=maxr) if(i < r)if(str[i][maxc] =='.')ans++;
            if(i < c)if(str[maxr][i] =='.')ans++;
        }

        cout <<ans<< '\n';
    }
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <random>
#include <complex>

#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define reset(x, y) memset(x, y, sizeof(x))
#define BUG(x) cerr << #x << " = " << (x) << endl
#define BUGP(x) cout << #x << " = " << (x)._1 << ", " << (x)._2 << endl
int const INF = (int) 1e9 + 1e3;
long long const INFL = (long long) 1e18 + 1e6;
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

const int dr[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dc[] = {0, -1, 0, 1, -1, 1, -1, 1};

// Head
int main() {
    int q;
    cin >> q;

    string str[50000 + 5];
    while (q--) {
        int r, c, maxr = 0, maxc = 0;
        cin >> r >> c;
        int maxx =0;
        for (int i = 0; i < r; ++i) {
            cin >> str[i];
            int star = 0;
            for (auto it: str[i]) {
                if (it == '*') star++;
            }
            if (star > maxx) {
                maxx =star;
                maxr = i;
            }
        }
        maxx =0;
        for (int i = 0; i < c; ++i) {
            int star = 0;
            for (int j = 0; j < r; j++) {

                if (str[j][i] == '*') {
                    star++;
                    if(j== maxr) star--;
                }

            }
            if ( star > maxx) {
                maxx =star;
                    maxc = i;
            }
        }
        int ans=0, i = max(r,c);
//        cout << maxr << " " << maxc << endl;
        while(i--){
            if(i!=maxr) if(i < r)if(str[i][maxc] =='.')ans++;
            if(i < c)if(str[maxr][i] =='.')ans++;
        }

        cout <<ans<< '\n';
    }
}


#include <iostream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <string>
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <random>
#include <complex>

#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define sqr(x) ((x) * (x))
#define all(x) (x).begin(), (x).end()
#define uni(x) (x).erase(unique(all(x)), (x).end())
#define reset(x, y) memset(x, y, sizeof(x))
#define BUG(x) cerr << #x << " = " << (x) << endl
#define BUGP(x) cout << #x << " = " << (x)._1 << ", " << (x)._2 << endl
int const INF = (int) 1e9 + 1e3;
long long const INFL = (long long) 1e18 + 1e6;
using namespace std;

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

const int dr[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dc[] = {0, -1, 0, 1, -1, 1, -1, 1};

// Head
int main() {
    int q;
    cin >> q;

    string str[50000 + 5];
    while (q--) {
        int r, c, maxr = 0, maxc = 0;
        cin >> r >> c;
        int maxx =0;
        for (int i = 0; i < r; ++i) {
            cin >> str[i];
            int star = 0;
            for (auto it: str[i]) {
                if (it == '*') star++;
            }
            if (star > maxx) {
                maxx =star;
                maxr = i;
            }
        }
        maxx =0;
        for (int i = 0; i < c; ++i) {
            int star = 0;
            for (int j = 0; j < r; j++) {
                if (str[j][i] == '*') star++;
            }
            if ( star > maxx) {
                maxx =star;
                maxc = i;
            }
        }
        int ans=0, i = max(r,c);
//        cout << maxr << " " << maxc << endl;
        while(i--){
            if(i!=maxr) if(i < r)if(str[i][maxc] =='.')ans++;
            if(i < c)if(str[maxr][i] =='.')ans++;
        }

        cout <<ans<< '\n';
    }
}


#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

int main() {
    ios::sync_with_stdio(false);

#ifndef ONLINE_JUDGE
    freopen("A.in", "r", stdin);
    freopen("A.out", "w", stdout);
#endif

    int t;
    cin >> t;
    while (t--) {
        map<pair<int,int>,int> check;
        int xx=0;
        vector<vector<char> > arr;
        int n, m;
        cin >> n >> m;
        int minr = n + 1;
        int minc = m + 1;
        int temp = 0;
        for (int i = 0; i < n; i++) {
            vector<char> y;
            for (int j = 0; j < m; j++) {
                char w;
                cin >> w;
                y.push_back(w);
            }
            arr.push_back(y);
        }
        for (int i = 0; i < n; i++) {
            map<pair<int,int>,int> r=check;
            map<pair<int,int>,int> r1;
            for (int j = 0; j < m; j++) {
                if (arr[i][j] == '.') {
                    temp++;

                    r.insert(make_pair(make_pair(i,j),1));
                    r1.insert(make_pair(make_pair(i,j),1));
                }
            }
            if (minr > temp) {
                minr = temp;
                check=r1;
            }
            else if(minr==temp){
                check=r;
            }
            temp = 0;
        }

        temp = 0;
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                if (arr[j][i] == '.') {
                    temp++;
                    pair<int,int> qq=make_pair(j,i);
                    if(check[qq]==1)temp--;
                }
            }
            minc = min(temp, minc);
            temp = 0;
        }

        cout << minc + minr << endl;

    }

    return 0;

}


#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

int main() {
    ios::sync_with_stdio(false);

#ifndef ONLINE_JUDGE
    freopen("A.in", "r", stdin);
    freopen("A.out", "w", stdout);
#endif

    int t;
    cin >> t;
    while (t--) {
        map<pair<int,int>,int> check;
        int xx=0;
        vector<vector<char> > arr;
        int n, m;
        cin >> n >> m;
        int minr = n + 1;
        int minc = m + 1;
        int temp = 0;
        for (int i = 0; i < n; i++) {
            vector<char> y;
            for (int j = 0; j < m; j++) {
                char w;
                cin >> w;
                y.push_back(w);
            }
            arr.push_back(y);
        }
        for (int i = 0; i < n; i++) {
            map<pair<int,int>,int> r=check;
            map<pair<int,int>,int> r1;
            for (int j = 0; j < m; j++) {
                if (arr[i][j] == '.') {
                    temp++;

                    r.insert(make_pair(make_pair(i,j),1));
                    r1.insert(make_pair(make_pair(i,j),1));
                }
            }
            if (minr > temp) {
                minr = temp;
                check=r1;
            }
            else if(minr==temp){
                check=r;
            }
            temp = 0;
        }

        temp = 0;
        for (int i = 0; i < m; i++) {
        bool d=false;
            for (int j = 0; j < n; j++) {
                if (arr[j][i] == '.') {
                    temp++;
                    pair<int,int> qq=make_pair(j,i);
                    if(check[qq]==1&&!d){temp--;d=true;}
                }
            }
            minc = min(temp, minc);
            temp = 0;
        }
        cout << minc + minr << endl;

    }

    return 0;

}


#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

int main() {
    ios::sync_with_stdio(false);

#ifndef ONLINE_JUDGE
    freopen("A.in", "r", stdin);
    freopen("A.out", "w", stdout);
#endif

    int t;
    cin >> t;
    while (t--) {
        vector<vector<char> > arr;
        map<pair<int,int>,int> check;
        int n, m;
        cin >> n >> m;
        int minr = m + 1;
        int minc = n+ 1;
        int temp = 0;
        for (int i = 0; i < n; i++) {
            vector<char> y;
            for (int j = 0; j < m; j++) {
                char w;
                cin >> w;
                y.push_back(w);
            }
            arr.push_back(y);
        }
        for (int i = 0; i < n; i++) {
            map<pair<int,int>,int> r=check;
            map<pair<int,int>,int> r1;
            for (int j = 0; j < m; j++) {
                if (arr[i][j] == '.') {
                    temp++;

                    r.insert(make_pair(make_pair(i,j),1));
                    r1.insert(make_pair(make_pair(i,j),1));
                }
            }
            if (minr > temp) {
                minr = temp;
                check=r1;
            }
            else if(minr==temp){
                check=r;
            }
            temp = 0;
        }

        temp = 0;
        for (int i = 0; i < m; i++) {
        bool d=false;
            for (int j = 0; j < n; j++) {
                if (arr[j][i] == '.') {
                    temp++;
                    pair<int,int> qq=make_pair(j,i);
                    if(check[qq]==1&&!d){temp--;d=true;}
                }
            }
            minc = min(temp, minc);
            temp = 0;
        }
        int counter=0;
        if(n==1){
            for(int i=0;i<m;i++){
                if(arr[0][i]=='.')counter++;
            }
            cout << counter << endl;
        }
        else
        cout << minc + minr << endl;

    }
    return 0;

}


#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

int main() {
    ios::sync_with_stdio(false);

#ifndef ONLINE_JUDGE
    freopen("A.in", "r", stdin);
    freopen("A.out", "w", stdout);
#endif

    int t;
    cin >> t;
    while (t--) {
        vector<vector<char> > arr;
        map<pair<int, int>, int> check;
        int n, m;
        cin >> n >> m;
        int minr = m + 1;
        int minc = n + 1;
        int temp = 0;
        for (int i = 0; i < n; i++) {
            vector<char> y;
            map<pair<int, int>, int> r = check;
            map<pair<int, int>, int> r1;
            for (int j = 0; j < m; j++) {
                char w;
                cin >> w;
                y.push_back(w);
                if (arr[i][j] == '.') {
                    temp++;

                    r.insert(make_pair(make_pair(i, j), 1));
                    r1.insert(make_pair(make_pair(i, j), 1));
                }
            }
            arr.push_back(y);
            if (minr > temp) {
                minr = temp;
                check = r1;
            } else if (minr == temp) {
                check = r;
            }
            temp = 0;
        }
        for (int i = 0; i < m; i++) {
            bool d = false;
            for (int j = 0; j < n; j++) {
                if (arr[j][i] == '.') {
                    temp++;
                    pair<int, int> qq = make_pair(j, i);
                    if (check[qq] == 1 && !d) {
                        temp--;
                        d = true;
                    }
                }
            }
            minc = min(temp, minc);
            temp = 0;
        }
        int counter = 0;

        cout << minc + minr << endl;

    }
    return 0;

}


#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

int main() {
    ios::sync_with_stdio(false);

#ifndef ONLINE_JUDGE
    freopen("A.in", "r", stdin);
    freopen("A.out", "w", stdout);
#endif

    int t;
    cin >> t;
    while (t--) {
        vector<vector<char> > arr;
        map<pair<int, int>, int> check;
        int n, m;
        cin >> n >> m;
        int minr = m + 1;
        int minc = n + 1;
        int temp = 0;
        for (int i = 0; i < n; i++) {
            vector<char> y;
            map<pair<int, int>, int> r = check;
            map<pair<int, int>, int> r1;
            for (int j = 0; j < m; j++) {
                char w;
                cin >> w;
                y.push_back(w);
                if (w== '.') {
                    temp++;

                    r.insert(make_pair(make_pair(i, j), 1));
                    r1.insert(make_pair(make_pair(i, j), 1));
                }
            }
            arr.push_back(y);
            if (minr > temp) {
                minr = temp;
                check = r1;
            } else if (minr == temp) {
                check = r;
            }
            temp = 0;
        }
        for (int i = 0; i < m; i++) {
            bool d = false;
            for (int j = 0; j < n; j++) {
                if (arr[j][i] == '.') {
                    temp++;
                    pair<int, int> qq = make_pair(j, i);
                    if (check[qq] == 1 && !d) {
                        temp--;
                        d = true;
                    }
                }
            }
            minc = min(temp, minc);
            temp = 0;
        }
        int counter = 0;

        cout << minc + minr << endl;

    }
    return 0;

}


#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

int main() {
    ios::sync_with_stdio(false);

#ifndef ONLINE_JUDGE
    freopen("A.in", "r", stdin);
    freopen("A.out", "w", stdout);
#endif

    int t;
    cin >> t;
    while (t--) {
        vector<vector<char> > arr;
        map<pair<int,int>,int> check;
        int n, m;
        cin >> n >> m;
        int minr = n + 1;
        int minc = m + 1;
        int temp = 0;
        for (int i = 0; i < n; i++) {
            vector<char> y;
            for (int j = 0; j < m; j++) {
                char w;
                cin >> w;
                y.push_back(w);
            }
            arr.push_back(y);
        }
        for (int i = 0; i < n; i++) {
            map<pair<int,int>,int> r=check;
            map<pair<int,int>,int> r1;
            for (int j = 0; j < m; j++) {
                if (arr[i][j] == '.') {
                    temp++;

                    r.insert(make_pair(make_pair(i,j),1));
                    r1.insert(make_pair(make_pair(i,j),1));
                }
            }
            if (minr > temp) {
                minr = temp;
                check=r1;
            }
            else if(minr==temp){
                check=r;
            }
            temp = 0;
        }

        temp = 0;
        for (int i = 0; i < m; i++) {
        bool d=false;
            for (int j = 0; j < n; j++) {
                if (arr[j][i] == '.') {
                    temp++;
                    pair<int,int> qq=make_pair(j,i);
                    if(check[qq]==1&&!d){temp--;d=true;}
                }
            }
            minc = min(temp, minc);
            temp = 0;
        }
        int counter=0;
        if(n==1){
            for(int i=0;i<m;i++){
                if(arr[0][i]=='.')counter++;
            }
            cout << counter << endl;
        }
        else
        cout << minc + minr << endl;

    }
    return 0;

}


#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

int main() {
    ios::sync_with_stdio(false);

#ifndef ONLINE_JUDGE
    freopen("A.in", "r", stdin);
    freopen("A.out", "w", stdout);
#endif

    int t;
    cin >> t;
    while (t--) {
        map<int,int> check;
        int xx=0;
        vector<vector<char> > arr;
        int n, m;
        cin >> n >> m;
        int minr = n + 1;
        int minc = m + 1;
        int temp = 0;
        for (int i = 0; i < n; i++) {
            vector<char> y;
            for (int j = 0; j < m; j++) {
                char w;
                cin >> w;
                y.push_back(w);
            }
            arr.push_back(y);
        }
        for (int i = 0; i < n; i++) {
            map<int,int> r;
            for (int j = 0; j < m; j++) {
                if (arr[i][j] == '.') {
                    temp++;
                    r.insert(make_pair(j,1));
                }
            }
            if (minr > temp) {
                minr = temp;
                xx=i;
                check=r;
            }
            temp = 0;
        }

        temp = 0;
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                if (arr[j][i] == '.') {
                    temp++;
                    if(j==xx && check[i]==1)temp--;
                }
            }
            minc = min(temp, minc);
            temp = 0;
        }

        cout << minc + minr << endl;

    }

    return 0;

}


#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

int main() {
    ios::sync_with_stdio(false);

#ifndef ONLINE_JUDGE
    freopen("A.in", "r", stdin);
    freopen("A.out", "w", stdout);
#endif

    int t;
    cin >> t;
    while (t--) {
        vector<vector<char> > arr;
        vector<int> counter;
        int n, m;
        cin >> n >> m;
        int minr = m + 1;
        int minc = n + 1;
        int temp = 0;
        for (int i = 0; i < n; i++) {
            vector<char> y;
            for (int j = 0; j < m; j++) {
                char w;
                cin >> w;
                y.push_back(w);
                if (w== '.') {
                    temp++;
                }
            }
            arr.push_back(y);
            counter.push_back(temp);
            if (minr > temp) {
                minr = temp;
            }
            temp = 0;
        }
        for (int i = 0; i < m; i++) {
            bool d = false;
            for (int j = 0; j < n; j++) {
                if (arr[j][i] == '.') {
                    temp++;
                    if (counter[j]==minr && !d) {
                        temp--;
                        d = true;
                    }
                }
            }
            minc = min(temp, minc);
            temp = 0;
        }

        cout << minc + minr << endl;

    }
    return 0;

}


#include<stdio.h>
int main()
{
    int n,m,i,j,p,b[100009],d[100009],sum=0,count=0,max=0,e,f,g,h;
    scanf("%d",&n);
    while(n--){
     scanf("%d %d",&m,&p);
     char c[m][p];
     int a[m][p];
     for(i=0;i<m;i++){
            getchar();
        for(j=0;j<p;j++){
            scanf("%c",&c[i][j]);
            if(c[i][j]=='.')
                a[i][j]=0;
            else
                a[i][j]=1;
        }
     }
        for(i=0;i<m;i++){
            for(j=0;j<p;j++)
            {
                sum+=a[i][j];
            }
            b[i]=sum;
            sum=0;

        }
        for(i=0;i<p;i++){
            for(j=0;j<m;j++)
            {
                sum+=a[j][i];
            }
            d[i]=sum;
            sum=0;

        }
        for(i=0;i<m;i++){
            if(b[i]==p){
                count=0;
                max=p;
                e=i;
                break;
            }
            else if(i==0){
                max=b[i];
                e=i;
            }
            else if(b[i]>max){
                max=b[i];
                e=i;
            }
        }
        if(max<p)
            count=p-max;
            g=max;
         for(i=0;i<p;i++){
            if(d[i]==m){
                count=count;
                max=m;
                f=i;
                break;
            }
            else if(i==0){
                max=d[i];
                f=i;
            }
            else if(d[i]>max){
                max=d[i];
                f=i;
            }
        }
        if(max<m)
            count+=(m-max);
            h=max;
            if(c[e][f]=='.' && g!=p && h!=m)
                count--;
            printf("%d\n",count);

     }
    }


#include<stdio.h>
int main()
{
    int n,m,i,j,p,b[100009],d[100009],sum=0,count=0,max=0,e,f;
    scanf("%d",&n);
    while(n--){
     scanf("%d %d",&m,&p);
     char c[m][p];
     int a[m][p];
     for(i=0;i<m;i++){
            getchar();
        for(j=0;j<p;j++){
            scanf("%c",&c[i][j]);
            if(c[i][j]=='.')
                a[i][j]=0;
            else
                a[i][j]=1;
        }
     }
        for(i=0;i<m;i++){
            for(j=0;j<p;j++)
            {
                sum+=a[i][j];
            }
            b[i]=sum;
            sum=0;

        }
        for(i=0;i<p;i++){
            for(j=0;j<m;j++)
            {
                sum+=a[j][i];
            }
            d[i]=sum;
            sum=0;

        }
        for(i=0;i<m;i++){
            if(b[i]==p){
                count=0;
                max=p;
                e=i;
                break;
            }
            else if(i==0){
                max=b[i];
                e=i;
            }
            else if(b[i]>max){
                max=b[i];
                e=i;
            }
        }
        if(max<p)
            count=p-max;
         for(i=0;i<p;i++){
            if(d[i]==m){
                count=count;
                max=m;
                f=i;
                break;
            }
            else if(i==0){
                max=d[i];
                f=i;
            }
            else if(d[i]>max){
                max=d[i];
                f=i;
            }
        }
        if(max<m)
            count+=(m-max);
            if(c[e][f]=='.')
                count--;
            printf("%d\n",count);

     }
    }


#include<stdio.h>
int main()
{
    int n,m,i,j,p,b[100009],d[100009],sum=0,count=0,max=0,e,f,g,h;
    scanf("%d",&n);
    while(n--){
     scanf("%d %d",&m,&p);
     char c[m][p];
     int a[m][p];
     for(i=0;i<m;i++){
            getchar();
        for(j=0;j<p;j++){
            scanf("%c",&c[i][j]);
            if(c[i][j]=='.')
                a[i][j]=0;
            else
                a[i][j]=1;
        }
     }
        for(i=0;i<m;i++){
            for(j=0;j<p;j++)
            {
                sum+=a[i][j];
            }
            b[i]=sum;
            sum=0;

        }
        for(i=0;i<p;i++){
            for(j=0;j<m;j++)
            {
                sum+=a[j][i];
            }
            d[i]=sum;
            sum=0;

        }
        for(i=0;i<m;i++){
            if(b[i]==p){
                count=0;
                max=p;
                e=i;
                break;
            }
            else if(i==0){
                max=b[i];
                e=i;
            }
            else if(b[i]>=max){
                max=b[i];
                e=i;
            }
        }
        if(max<p)
            count=p-max;
            g=max;
         for(i=0;i<p;i++){
            if(d[i]==m){
                count=count;
                max=m;
                f=i;
                break;
            }
            else if(i==0){
                max=d[i];
                f=i;
            }
            else if(d[i]>=max){
                max=d[i];
                f=i;
            }
        }
        if(max<m)
            count+=(m-max);
            h=max;
            if(c[e][f]=='.' && g!=p && h!=m)
                count--;
            printf("%d\n",count);

     }
    }


#include <bits/stdc++.h>

using namespace std;

vector<string> s(50009);
vector<int> cntn(50009), cntm(50009);
int n, m, q;

int main()
{
    cin >> q;

    while (q --)
    {
        s.clear();
        cntn.clear();
        cntm.clear();

        cin >> n >> m;

        for (int i = 0; i < n; i ++)
            cin >> s[i];

        for (int i = 0; i < n; i ++)
        for (int j = 0; j < n; j ++)
        {
            cntn[i] += (s[i][j] == '.');
            cntm[j] += (s[i][j] == '.');
        }

        int ans = n + m;
        for (int i = 0; i < n; i ++)
        for (int j = 0; j < n; j ++)
            ans = min(ans, cntn[i] + cntm[j] - (s[i][j] == '.'));

        cout << ans << "\n";
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;
const int inf = 0x3f3f3f3f;

int q, n, m, r;
int tmpc[50009];
char row[50009];
char rows[50009];
int minr, minc;

int main()
{
    scanf("%d", &q);
    while (q --)
    {
        memset(tmpc, 0, sizeof(tmpc));
        minr = inf;
        minc = inf;

        scanf("%d%d", &n, &m);

        for (int i = 1; i <= n; i ++)
        {
            scanf("%s", row + 1);

            int tmpr = 0;
            for (int j = 1; j <= m; j ++)
            {
                if (row[j] == '.')
                {
                    tmpr ++;
                    tmpc[j] ++;
                }
            }

            if (tmpr < minr)
            {
                minr = tmpr;
                memcpy(rows, row, sizeof(row));
            }
        }

        for (int j = 1; j <= m; j ++)
        {
            if (rows[j] == '.')
                tmpc[j] --;
            if (minc > tmpc[j])
                minc = tmpc[j];
        }

        cout << minc + minr << endl;
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

vector<string> s(50009);
vector<int> cntn(n), cntm(m);
int n, m, q;

int main()
{
    cin >> q;

    while (q --)
    {
        cin >> n >> m;

        for (int i = 0; i < n; i ++)
            cin >> s[i];

        for (int i = 0; i < n; i ++)
        for (int j = 0; j < n; j ++)
        {
            cntn[i] += (s[i][j] == '.');
            cntm[j] += (s[i][j] == '.');
        }

        int ans = n + m;
        for (int i = 0; i < n; i ++)
        for (int j = 0; j < n; j ++)
            ans = min(ans, cntn[i] + cntm[j] - (s[i][j] == '.'));

        cout << ans << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

vector<string> s(50009);
int cntn[50009], cntm[50009];
int n, m, q;

int main()
{
    cin >> q;

    while (q --)
    {
        memset(cntn, 0, sizeof(cntn));
        memset(cntm, 0, sizeof(cntm));

        cin >> n >> m;

        for (int i = 0; i < n; i ++)
            cin >> s[i];

        for (int i = 0; i < n; i ++)
        for (int j = 0; j < m; j ++)
        {
            cntn[i] += (s[i][j] == '.');
            cntm[j] += (s[i][j] == '.');
        }

        int ans = n + m;
        for (int i = 0; i < n; i ++)
        for (int j = 0; j < m; j ++)
            ans = min(ans, cntn[i] + cntm[j] - (s[i][j] == '.'));

        cout << ans << "\n";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

vector<string> s(50009);
vector<int> cntn(50009), cntm(50009);
int n, m, q;

int main()
{
    cin >> q;

    while (q --)
    {
        cin >> n >> m;

        for (int i = 0; i < n; i ++)
            cin >> s[i];

        for (int i = 0; i < n; i ++)
        for (int j = 0; j < n; j ++)
        {
            cntn[i] += (s[i][j] == '.');
            cntm[j] += (s[i][j] == '.');
        }

        int ans = n + m;
        for (int i = 0; i < n; i ++)
        for (int j = 0; j < n; j ++)
            ans = min(ans, cntn[i] + cntm[j] - (s[i][j] == '.'));

        cout << ans << "\n";
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;
const int inf = 0x3f3f3f3f;

int q, n, m, r, minr, minc;
int tmpc[50009];
char gra[50009][50009];

int main()
{
    scanf("%d", &q);
    while (q --)
    {
        memset(tmpc, 0, sizeof(tmpc));
        minr = inf;
        minc = inf;

        scanf("%d%d", &n, &m);

        for (int i = 1; i <= n; i ++)
        {
            scanf("%s", gra[i] + 1);

            int tmpr = 0;
            for (int j = 1; j <= m; j ++)
            {
                if (gra[i][j] == '.')
                    tmpr += 1, tmpc[j] += 1;
            }

            if (tmpr < minr)
            {
                minr = tmpr;
                r = i;
            }
        }

        for (int j = 1; j <= m; j ++)
        {
            if (gra[r][j] == '.')
                tmpc[j] -= 1;
            if (minc > tmpc[j])
                minc = tmpc[j];
        }

        cout << minc + minr << endl;
    }

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;
const int inf = 0x3f3f3f3f;

int q, n, m, r;
int tmpc[50009];
char row[50009];
char rows[50009];
int minr, minc;

int main()
{
    scanf("%d", &q);
    while (q --)
    {
        memset(tmpc, 0, sizeof(tmpc));
        minr = inf;
        minc = inf;

        scanf("%d%d", &n, &m);

        for (int i = 1; i <= n; i ++)
        {
            scanf("%s", row + 1);

            int tmpr = 0;
            for (int j = 1; j <= m; j ++)
            {
                if (row[j] == '.')
                {
                    tmpr += 1;
                    tmpc[j] += 1;
                }
            }

            if (tmpr < minr)
            {
                minr = tmpr;
                memcpy(rows, row, sizeof(row));
            }
        }

        for (int j = 1; j <= m; j ++)
        {
            if (rows[j] == '.')
                tmpc[j] --;
            if (minc > tmpc[j])
                minc = tmpc[j];
        }

        cout << minc + minr << endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,b,a) for(ll i=b;i>=a;i--)
#define clr(x,xx)       memset(x,xx,sizeof(x))

#define read()       freopen("in.txt","r",stdin)
#define write()      freopen("out.txt","w",stdout)

#define pf2(x,y)    printf("%lld %lld",x,y)
#define pf1(x) printf("%lld ",x)
//#define sp printf(" ");

#define sc1(x) scanf("%lld",&x)
#define sc2(x,y)    scanf("%lld %lld",&x,&y)
#define nl printf("\n")
#define pb push_back
#define ff first
#define ss second

#define vsort(v) sort(v.begin(),v.end())

#define deb(x,y) printf("YES %lld   %lld\n",x,y)

#define   timesave      ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
ll arr1[50005],arr2[50005];
int main()
{
    ll test;
    //timesave
    while(cin>>test)
    {
       fr(t,1,test)
       {
           clr(arr1,0);
           clr(arr2,0);
          // char s[50000][50000];
           string s[50005];
           ll r,c;
           sc2(r,c);
//           cin>>r>>c;
           fr(i,0,r-1)
             cin>>s[i];
           ll row=-1;
           fr(i,0,r-1)
           {
               ll cnt=0;
               fr(j,0,c-1)
               {
                   if(s[i][j]=='*')
                    {
                        arr1[i]+=1;
                        arr2[j]+=1;
                    }
               }
               //row=max(row,cnt);

           }

          ll ans=0;
           fr(i,0,r-1)
           {
               fr(j,0,c-1)
               {
                  // cout<<i<<" "<<j<<endl;
                   ll x=arr1[i]+arr2[j];
                   //cout<<arr1[i]<<" "<<arr2[j]<<" ";
                   if(s[i][j]=='.')
                   {
                      x+=1;

                   }
                   //cout<<x<<endl;
                   ans=max(ans,x);
               }
           }
           //cout<<col<<endl;
           cout<<(r+c)-ans<<endl;
       }
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,b,a) for(ll i=b;i>=a;i--)
#define clr(x,xx)       memset(x,xx,sizeof(x))

#define read()       freopen("in.txt","r",stdin)
#define write()      freopen("out.txt","w",stdout)

#define pf2(x,y)    printf("%lld %lld",x,y)
#define pf1(x) printf("%lld ",x)
//#define sp printf(" ");

#define sc1(x) scanf("%lld",&x)
#define sc2(x,y)    scanf("%lld %lld",&x,&y)
#define nl printf("\n")
#define pb push_back
#define ff first
#define ss second

#define vsort(v) sort(v.begin(),v.end())

#define deb(x,y) printf("YES %lld   %lld\n",x,y)

#define   timesave      ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
ll arr1[50005],arr2[50005];
int main()
{
    ll test;
    timesave
    while(cin>>test)
    {
       fr(t,1,test)
       {
           clr(arr1,0);
           clr(arr2,0);
          // char s[50000][50000];
           string s[50005];
           ll r,c;
           sc2(r,c);
//           cin>>r>>c;
           fr(i,0,r-1)
             cin>>s[i];
           ll row=-1;
           fr(i,0,r-1)
           {
               ll cnt=0;
               fr(j,0,c-1)
               {
                   if(s[i][j]=='*')
                    {
                        arr1[i]+=1;
                        arr2[j]+=1;
                    }
               }
               //row=max(row,cnt);

           }

          ll ans=0;
           fr(i,0,r-1)
           {
               fr(j,0,c-1)
               {
                  // cout<<i<<" "<<j<<endl;
                   ll x=arr1[i]+arr2[j];
                   //cout<<arr1[i]<<" "<<arr2[j]<<" ";
                   if(s[i][j]=='.')
                   {
                      x+=1;

                   }
                   //cout<<x<<endl;
                   ans=max(ans,x);
               }
           }
           //cout<<col<<endl;
           cout<<(r+c)-ans<<endl;
       }
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,b,a) for(ll i=b;i>=a;i--)
#define clr(x,xx)       memset(x,xx,sizeof(x))

#define read()       freopen("in.txt","r",stdin)
#define write()      freopen("out.txt","w",stdout)

#define pf2(x,y)    printf("%lld %lld",x,y)
#define pf1(x) printf("%lld ",x)
//#define sp printf(" ");

#define sc1(x) scanf("%lld",&x)
#define sc2(x,y)    scanf("%lld %lld",&x,&y)
#define nl printf("\n")
#define pb push_back
#define ff first
#define ss second

#define vsort(v) sort(v.begin(),v.end())

#define deb(x,y) printf("YES %lld   %lld\n",x,y)

#define   timesave      ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
ll arr1[50005],arr2[50005];
int main()
{
    ll test;
    timesave
    (cin>>test)
    {
       fr(t,1,test)
       {
           clr(arr1,0);
           clr(arr2,0);
          // char s[50000][50000];
           string s[50005];
           ll r,c;
           sc2(r,c);
//           cin>>r>>c;
           for(ll i=0;i<r;i++)
             cin>>s[i];
           ll row=-1;
           fr(i,0,r-1)
           {
               ll cnt=0;
               fr(j,0,c-1)
               {
                   if(s[i][j]=='*')
                    {
                        arr1[i]+=1;
                        arr2[j]+=1;
                    }
               }
               //row=max(row,cnt);

           }

          ll ans=0;
           fr(i,0,r-1)
           {
               fr(j,0,c-1)
               {
                  // cout<<i<<" "<<j<<endl;
                   ll x=arr1[i]+arr2[j];
                   //cout<<arr1[i]<<" "<<arr2[j]<<" ";
                   if(s[i][j]=='.')
                   {
                      x+=1;

                   }
                   //cout<<x<<endl;
                   ans=max(ans,x);
               }
           }
           //cout<<col<<endl;
           cout<<(r+c)-ans<<endl;
       }
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,b,a) for(ll i=b;i>=a;i--)
#define clr(x,xx)       memset(x,xx,sizeof(x))

#define read()       freopen("in.txt","r",stdin)
#define write()      freopen("out.txt","w",stdout)

#define pf2(x,y)    printf("%lld %lld",x,y)
#define pf1(x) printf("%lld ",x)
//#define sp printf(" ");

#define sc1(x) scanf("%lld",&x)
#define sc2(x,y)    scanf("%lld %lld",&x,&y)
#define nl printf("\n")
#define pb push_back
#define ff first
#define ss second

#define vsort(v) sort(v.begin(),v.end())

#define deb(x,y) printf("YES %lld   %lld\n",x,y)

#define   timesave      ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
ll arr1[50005],arr2[50005];
int main()
{
    ll test;
    timesave
    cin>>test;
    {
       fr(t,1,test)
       {
           clr(arr1,0);
           clr(arr2,0);
          // char s[50000][50000];
           string s[50005];
           ll r,c;
           sc2(r,c);
//           cin>>r>>c;
           for(ll i=0;i<r;i++)
             cin>>s[i];
           ll row=-1;
           fr(i,0,r-1)
           {
               ll cnt=0;
               fr(j,0,c-1)
               {
                   if(s[i][j]=='*')
                    {
                        arr1[i]+=1;
                        arr2[j]+=1;
                    }
               }
               //row=max(row,cnt);

           }

          ll ans=0;
           fr(i,0,r-1)
           {
               fr(j,0,c-1)
               {
                  // cout<<i<<" "<<j<<endl;
                   ll x=arr1[i]+arr2[j];
                   //cout<<arr1[i]<<" "<<arr2[j]<<" ";
                   if(s[i][j]=='.')
                   {
                      x+=1;

                   }
                   //cout<<x<<endl;
                   ans=max(ans,x);
               }
           }
           //cout<<col<<endl;
           cout<<(r+c)-ans<<endl;
       }
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,b,a) for(ll i=b;i>=a;i--)
#define clr(x,xx)       memset(x,xx,sizeof(x))

#define read()       freopen("in.txt","r",stdin)
#define write()      freopen("out.txt","w",stdout)

#define pf2(x,y)    printf("%lld %lld",x,y)
#define pf1(x) printf("%lld ",x)
//#define sp printf(" ");

#define sc1(x) scanf("%lld",&x)
#define sc2(x,y)    scanf("%lld %lld",&x,&y)
#define nl printf("\n")
#define pb push_back
#define ff first
#define ss second

#define vsort(v) sort(v.begin(),v.end())

#define deb(x,y) printf("YES %lld   %lld\n",x,y)

#define   timesave      ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
ll arr1[50005],arr2[50005];
int main()
{
    ll test;
    timesave
    while(cin>>test)
    {
       fr(t,1,test)
       {
           clr(arr1,0);
           clr(arr2,0);
          // char s[50000][50000];
           string s[50005];
           ll r,c;
           sc2(r,c);
//           cin>>r>>c;
           for(ll i=0;i<r;i++)
             cin>>s[i];
           ll row=-1;
           fr(i,0,r-1)
           {
               ll cnt=0;
               fr(j,0,c-1)
               {
                   if(s[i][j]=='*')
                    {
                        arr1[i]+=1;
                        arr2[j]+=1;
                    }
               }
               //row=max(row,cnt);

           }

          ll ans=0;
           fr(i,0,r-1)
           {
               fr(j,0,c-1)
               {
                  // cout<<i<<" "<<j<<endl;
                   ll x=arr1[i]+arr2[j];
                   //cout<<arr1[i]<<" "<<arr2[j]<<" ";
                   if(s[i][j]=='.')
                   {
                      x+=1;

                   }
                   //cout<<x<<endl;
                   ans=max(ans,x);
               }
           }
           //cout<<col<<endl;
           cout<<(r+c)-ans<<endl;
       }
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,b,a) for(ll i=b;i>=a;i--)
#define clr(x,xx)       memset(x,xx,sizeof(x))

#define read()       freopen("in.txt","r",stdin)
#define write()      freopen("out.txt","w",stdout)

#define pf2(x,y)    printf("%lld %lld",x,y)
#define pf1(x) printf("%lld ",x)
//#define sp printf(" ");

#define sc1(x) scanf("%lld",&x)
#define sc2(x,y)    scanf("%lld %lld",&x,&y)
#define nl printf("\n")
#define pb push_back
#define ff first
#define ss second

#define vsort(v) sort(v.begin(),v.end())

#define deb(x,y) printf("YES %lld   %lld\n",x,y)

#define   timesave      ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
ll arr1[50005],arr2[50005];
int main()
{
    ll test;
    timesave
    while(cin>>test)
    {
       fr(t,1,test)
       {
           string s[50005];
           ll r,c;
           cin>>r>>c;
           fr(i,0,r-1)
             cin>>s[i];
           ll row=-1;
           fr(i,0,r-1)
           {
               ll cnt=0;
               fr(j,0,c-1)
               {
                   if(s[i][j]=='*')
                    cnt++;
               }
               //row=max(row,cnt);
               arr1[i]=cnt;
           }
          // cout<<row <<" ";
           ll col=0;

           fr(i,0,c-1)
           {
               ll cnt=0;
               fr(j,0,r-1)
               {
                   if(s[j][i]=='*')
                    cnt++;
               }
               //col=max(col,cnt);
               arr2[i]=cnt;
           }
//           cout<<"FDJ"<<arr2[2]<<endl;
//           cout<<col<<endl;
          ll ans=0;
           fr(i,0,r-1)
           {
               fr(j,0,c-1)
               {
                  // cout<<i<<" "<<j<<endl;
                   ll x=arr1[i]+arr2[j];
                   //cout<<arr1[i]<<" "<<arr2[j]<<" ";
                   if(s[i][j]=='.')
                   {
                      x+=1;

                   }
                   //cout<<x<<endl;
                   ans=max(ans,x);
               }
           }
           //cout<<col<<endl;
           cout<<(r+c)-ans<<endl;
       }
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,a,b) for(ll i=a;i<=b;i++)
#define frr(i,b,a) for(ll i=b;i>=a;i--)
#define clr(x,xx)       memset(x,xx,sizeof(x))

#define read()       freopen("in.txt","r",stdin)
#define write()      freopen("out.txt","w",stdout)

#define pf2(x,y)    printf("%lld %lld",x,y)
#define pf1(x) printf("%lld ",x)
//#define sp printf(" ");

#define sc1(x) scanf("%lld",&x)
#define sc2(x,y)    scanf("%lld %lld",&x,&y)
#define nl printf("\n")
#define pb push_back
#define ff first
#define ss second

#define vsort(v) sort(v.begin(),v.end())

#define deb(x,y) printf("YES %lld   %lld\n",x,y)

#define   timesave      ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
ll arr1[50005],arr2[50005];
int main()
{
    ll test;
    timesave
     string s[50005];
    while(cin>>test)
    {
       fr(t,1,test)
       {

           ll r,c;
           cin>>r>>c;
           fr(i,0,r-1)
             cin>>s[i];
           ll row=-1;
           fr(i,0,r-1)
           {
               ll cnt=0;
               fr(j,0,c-1)
               {
                   if(s[i][j]=='*')
                    cnt++;
               }
               //row=max(row,cnt);
               arr1[i]=cnt;
           }
          // cout<<row <<" ";
           ll col=0;

           fr(i,0,c-1)
           {
               ll cnt=0;
               fr(j,0,r-1)
               {
                   if(s[j][i]=='*')
                    cnt++;
               }
               //col=max(col,cnt);
               arr2[i]=cnt;
           }
//           cout<<"FDJ"<<arr2[2]<<endl;
//           cout<<col<<endl;
          ll ans=0;
           fr(i,0,r-1)
           {
               fr(j,0,c-1)
               {
                  // cout<<i<<" "<<j<<endl;
                   ll x=arr1[i]+arr2[j];
                   //cout<<arr1[i]<<" "<<arr2[j]<<" ";
                   if(s[i][j]=='.')
                   {
                      x+=1;

                   }
                   //cout<<x<<endl;
                   ans=max(ans,x);
               }
           }
           //cout<<col<<endl;
           cout<<(r+c)-ans<<endl;
       }
    }
}


#include<bits/stdc++.h>
#define ll long long
#define boost1 ios_base::sync_with_stdio(false);
#define boost2 cin.tie(0);cout.tie(0);
using namespace std;

int main()
{
    boost1 boost2
    int t;cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        char A[n][m];
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++) cin>>A[i][j];
        }
        int row[n]={0};
        int column[m]={0};
        for(int i=0;i<n;i++)
        {
            int sum=0;
            for(int j=0;j<m;j++)
            {
                if(A[i][j]== '.') sum++;
            }
            row[i]=sum;
        }
        int min_row = *min_element(row,row+n);
        int ans = min_row;
        int index;
        for(int i=0;i<n;i++)
        {
            if(row[i]==min_row) index=i;
        }
        for(int j=0;j<m;j++)
        {
            A[index][j]='*';
        }
        for(int i=0;i<m;i++)
        {
            int sum=0;
            for(int j=0;j<n;j++)
            {
                if(A[j][i]== '.') sum++;
            }
            column[i]=sum;
        }
        int min_column = *min_element(column,column+m);
        ans += min_column;
        cout<<ans<<endl;

    }
}


#include<bits/stdc++.h>
#define crap ios_base::sync_with_stdio(0);cin.tie(0)
#define ll long long
#define lld long long int
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define N 1000005
#define M 1000001

using namespace std;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
   int t;cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        char A[n][m];
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++) cin>>A[i][j];
        }
        int row[n]={0};
        int column[m]={0};
        for(int i=0;i<n;i++)
        {
        	for(int j=0;j<m;j++)
        	{
        		if(A[i][j]=='.')
        		{
        			row[i]++;
        			column[j]++;
        		}
        	}
        }
        int ans = INT_MAX;
        for(int i=0;i<n;i++)
        	{
        		for (int j = 0; j < m; j++)
        	   {
        		/* code */
                      ans = min(ans,row[i]+column[j]- (A[i][j]=='.'));
        	   }
        }
        cout<<ans<<endl;

    }

}


#include<bits/stdc++.h>
#define crap ios_base::sync_with_stdio(0);cin.tie(0)
#define ll long long
#define pb push_back
#define ff first
#define ss second
using namespace std;

#define int ll

int32_t main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("outpt.txt", "w", stdout);
    #endif
    crap;

    int t; cin>>t;
    while(t--){
      int n,m; cin>>n>>m;
      char A[n][m];
      for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin>>A[i][j];

      int ans=999999999;
      int row[n];
      int column[m];
      for(int i=0;i<n;i++){
        int p=0;
        for(int j=0;j<m;j++){
           if(A[i][j]=='.') p++;
        }
        row[i]=p;
      }

       for(int i=0;i<m;i++){
        int p=0;
        for(int j=0;j<n;j++){
           if(A[j][i]=='.') p++;
        }
        column[i]=p;
       }
       for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
          int k = row[i]+column[j];
          if(A[i][j]=='.') k--;
          ans = min(ans,k);
        }
       }

      cout<<ans<<endl;
    }

}


#include<bits/stdc++.h>
#define ll long long
#define boost1 ios_base::sync_with_stdio(false);
#define boost2 cin.tie(0);cout.tie(0);
using namespace std;

int main()
{
    boost1 boost2
    int t;cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        char A[n][m];
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++) cin>>A[i][j];
        }
        int row[n]={0};
        int column[m]={0};
        for(int i=0;i<n;i++)
        {
            int sum=0;
            for(int j=0;j<m;j++)
            {
                if(A[i][j]== '.') sum++;
            }
            row[i]=sum;
        }
        int min_row = *min_element(row,row+n);
        ll ans = min_row;
        int index;
        for(int i=0;i<n;i++)
        {
            if(row[i]==min_row) index=i;
        }
        for(int j=0;j<m;j++)
        {
            A[index][j]='*';
        }
        for(int i=0;i<m;i++)
        {
            int sum=0;
            for(int j=0;j<n;j++)
            {
                if(A[j][i]== '.') sum++;
            }
            column[i]=sum;
        }
        int min_column = *min_element(column,column+m);
        ans += min_column;
        cout<<ans<<"\n";

    }
}


#include<bits/stdc++.h>
#define crap ios_base::sync_with_stdio(0);cin.tie(0)
#define ll long long
#define lld long long int
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define N 1000005
#define M 1000001

using namespace std;

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
   int t;cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        char A[n][m];
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++) cin>>A[i][j];
        }
        int row[n]={0};
        int column[m]={0};
        for(int i=0;i<n;i++)
        {
            int sum=0;
            for(int j=0;j<m;j++)
            {
                if(A[i][j]== '.') sum++;
            }
            row[i]=sum;
        }
        int min_row = *min_element(row,row+n);
        int ans = min_row;
        vector<int> index;
        for(int i=0;i<n;i++)
        {
            if(row[i]==min_row) index.pb(i);
        }
        for(int i=0;i<index.size();i++)
        for(int j=0;j<m;j++)
        {
            A[index[i]][j]='*';
        }
        for(int i=0;i<m;i++)
        {
            int sum=0;
            for(int j=0;j<n;j++)
            {
                if(A[j][i]== '.') sum++;
            }
            column[i]=sum;
        }
        int min_column = *min_element(column,column+m);
        ans += min_column;
        cout<<ans<<endl;

    }

}


#include<bits/stdc++.h>
#define ll long long
#define boost1 ios_base::sync_with_stdio(false);
#define boost2 cin.tie(0);cout.tie(0);
using namespace std;

int main()
{
    boost1 boost2
    int t;cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        char A[n][m];
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++) cin>>A[i][j];
        }
        int row[n]={0};
        int column[m]={0};
        for(int i=0;i<n;i++)
        {
            int sum=0;
            for(int j=0;j<m;j++)
            {
                if(A[i][j]== '.') sum++;
            }
            row[i]=sum;
        }
        int min_row = *min_element(row,row+n);
        ll ans = min_row;
        int index;
        for(int i=0;i<n;i++)
        {
            if(row[i]==min_row) index=i;
        }
        for(int j=0;j<m;j++)
        {
            A[index][j]='*';
        }
        for(int i=0;i<m;i++)
        {
            int sum=0;
            for(int j=0;j<n;j++)
            {
                if(A[j][i]== '.') sum++;
            }
            column[i]=sum;
        }
        int min_column = *min_element(column,column+m);
        ans += min_column;
        cout<<ans<<endl;

    }
}