#include<iostream>
#define ll long long
#include<vector>
#include<stack>
#include<string>
#include<algorithm>
using namespace std;
void solve()
{
string s;
cin >> s;
// "#programming#"
// result = 2
// because # repeat twice
int result = count(s.begin(), s.end(), '#');
cout << result << "
";
}
int main()
{
int t;
cin >> t;
while (t--)
{
solve();
}
return 0;
}