#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll cnt[26];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s;
	cin>>s;
	s = '#' + s;
	ll ans = 0;
	int n = s.length();
	cnt[s[n-1]-'a']++;
	ll total = 1;
	
	for(int i=n-2; i>=1; i--){
		cnt[s[i]-'a']++;
		total++;
		
		if(s[i]==s[i+1]){
			ans+=(total - cnt[s[i]-'a']);
			memset(cnt,0,sizeof(cnt));
			cnt[s[i]-'a'] = total;
		}
	}
	cout<<ans;
}
#include<bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define zero(v) memset(v,0,sizeof(v))
#define rep(i,n) for(int i=0;i<(n);i++)
#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define all(v) (v).begin(),(v).end()
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
typedef long long ll;
typedef unsigned uint;
const int INF=0x3f3f3f3f;
const double EPS=1e-10;
typedef pair<int,int> pii;
int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)
{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}
while((uint)((c=getchar())-'0')<10);return x;}

ll n;

int main(){
	scanf("%lld",&n);
	vector<ll>ans;
	for(ll i=1;i*i<=n;i++){
		if(n%i==0){
			if(i*i==n){
				ans.push_back(i);
			}else{
				ans.push_back(i);
				ans.push_back(n/i);
			}
		}
	}
	sort(all(ans));
	rep(i,SZ(ans))printf("%lld\n",ans[i]);
	return 0;
}
