#include <iostream>
#include <map>
#include <list>
#include <bitset>
#include <vector>
#include <cmath>
using namespace std;
vector<pair<int, int>> GetCutRanges(string s)
{
bitset<256> Visited;
vector<pair<int, int>> CutRanges;
for(int i=0;i<s.length();i++)
{
int j=i+1;
Visited[i]=true;
for(;j<s.length();j++)
{
if(Visited[s[j]])
{
pair<int, int> RangeContainsCut = {i, j};
CutRanges.push_back(RangeContainsCut);
break;
}
Visited[s[i]] = true;
}
Visited.reset();
}
return CutRanges;
}
__int64 calculate(string s)
{
string temp = s;
vector<pair<int, int>> CutRanges = GetCutRanges(s);
list<int> OverlapLengths;
__int64 answer=1;
if(CutRanges.size()<1) return pow(2, s.length()-1);
int Multiplier = pow(2, s.length()-1-CutRanges.back().second);
for(int i=0;i<CutRanges.size();i++)
{
pair<int,int> CurrentPair = CutRanges[i];
//cout<<answer<<endl<<CurrentPair.first<<" : "<<CurrentPair.second<<endl;
answer*= pow(2, CurrentPair.second-CurrentPair.first-1);
if(CurrentPair!=CutRanges.back() && CutRanges[i+1].first<CurrentPair.second)
{
const int OverlapLength = CurrentPair.second-CutRanges[i+1].first+1;
OverlapLengths.push_back(OverlapLength);
}
}
for(int i : OverlapLengths)
{
answer+=__int64(i+1);
}
if(OverlapLengths.size()==0)
{
answer++;
}
answer*=Multiplier;
//cout<<endl<<answer;
return answer;
}
int main()
{
string s;
cin>>s;
cout<<calculate(s);
return 0;
}