#include #if __has_include() #include #endif using namespace std; #define eb emplace_back #define fo(i,...) for(auto[i,i##stop,i##step]=for_range(0,__VA_ARGS__);ivoid pp(const auto&...a){[[maybe_unused]]const char*c="";((o<(a...);} #define entry defpp void main();void main2();}int main(){my::io();my::main();}namespace my{ #define use_ml1000000007 using ml=atcoder::modint1000000007; namespace my{ auto&operator<<(ostream&o,const atcoder::modint1000000007&x){return o<<(int)x.val();} void io(){cin.tie(nullptr)->sync_with_stdio(0);cout<constexpr auto for_range(T s,T b){T a=0;if(s)swap(a,b);return array{a-s,b,1-s*2};} void lin(auto&...a){(cin>>...>>a);} auto encode_alphabet(char c){return c-'a';} templatestruct pair{ A a;B b; pair()=default; pair(A aa,B bb):a(aa),b(bb){} auto operator<=>(const pair&)const=default; }; templateusing pack_back_t=tuple_element_t>; } namespace my{ templateconcept vectorial=is_base_of_v::value_type>,remove_cvref_t>; templateconstexpr int depth=0; templateconstexpr int depth =depth+1; templatestruct core_t_helper{using type=T;}; templatestruct core_t_helper{using type=typename core_t_helper::type;}; templateusing core_t=core_t_helper::type; templatestruct vec; templatestruct hvec_helper{using type=vec::type>;}; templatestruct hvec_helper<0,T>{using type=T;}; templateusing hvec=hvec_helper::type; templatestruct vec:vector{ static constexpr int D=depth+1; using C=core_t; using vector::vector; vec(const auto&...a)requires(sizeof...(a)>=3){resizes(a...);} void resizes(const auto&...a){if constexpr(sizeof...(a)==D){ }else*this=make(a...);} static auto make(ll n,const auto&...a){ if constexpr(sizeof...(a)==1)return vec(n,array{a...}[0]); else return vec(n,make(a...)); } ll size()const{return vector::size();} auto&emplace_back(auto&&...a){vector::emplace_back(std::forward(a)...);return*this;} auto fold(const auto&f)const{ pairr{}; fe(*this,e){ if constexpr(!vectorial){ if(r.b)f(r.a,e); else r={e,1}; }else { } } return r; } auto max()const{return fold([](auto&a,auto b){if(a=0); if(M==-1)M=max(); vec>res(M+1,0,0); fo(i,size())res[(*this)[i]].eb(i); return res; } }; templaterequires(sizeof...(A)>=2)vec(const A&...a)->vec>>; auto sin(){string s;lin(s);return s;} templateauto sinen_alphabet(){vecr;fe(sin(),e)r.eb(encode_alphabet(e));return r;} } namespace my{entry void main(){ auto s=sinen_alphabet(); ll N=s.size(); auto g=s.pos_groups(); use_ml1000000007 ml inv2=1/ml(2); ml S=0; fo(c,g.size()){ ml su=0; ml t=0; fe(g[c],i)su+=inv2.pow(i); fe(g[c],i){ su-=inv2.pow(i); t+=ml(2).pow(i)*su; } S+=ml(2).pow(N-1)*t; } pp(ml(2).pow(N)-1+ml(2).pow(N-1)*(N-2)+1-S); }}