#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<ll,int>Pli;
typedef pair<int,int> Pi;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	// 1 変数を入れる;
	int x,y;
	ll cost;
};

int main(){

	string s;
	cin>>s;
	char c='A';
	int si=s.size()-1;
	ll ans=0;
	for(int i=s.size()-1; i>0; i--){
		if(s[i]==s[i-1]){
			if(s[i]==c)ans+=si-i-1;
			else ans+=s.size()-i-1;
			c=s[i];
			while(s[i]==c)i--;
			i++;
			si=i;
		}
	}
	c='A';
	for(int i=0; i<s.size(); i++){
		if(s[i]!=s[i+1]&&c==s[i])ans--;
		if(s[i]==s[i+1]){
			c=s[i];
			while(s[i]==c)i++;
			i--;
		}
	}
	cout<<ans<<endl;

	return 0;
}


#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int INF = 1001001;

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  map<string,int> mp;
  rep(i,n) {
    cin >> s[i];
    mp[s[i]] = 1;
  }

  for(auto iter = mp.begin(); iter != mp.end(); iter++){
    if(iter->first[0] == '!') continue;
    else {
      string temp = "!" + iter->first;
      if(mp[temp] == 1){
        cout<<iter->first<<endl;
        return 0;
      }
    }
  }
  cout<<"satisfiable"<<endl;
  return 0;
}
