#include<iostream>#include<cstring>#include<string>using namespace std;int arr[10000],len,ans[10000];int dp(int id){ if(ans[id]!=-1)return ans[id];int s;if(id==len) s=1;else if(id==len-1) s=arr[id]>0?1:0;else if(arr[id]==0) s=0;else if(10*arr[id]+arr[id+1]<=26) s=dp(id+1)+dp(id+2);else s=dp(id+1); ans[id]=s;return ans[id];}int main(){ string str;while(cin>>str&&str!="0") { len=str.size();for(int i=0;i<len;++i) arr[i]=str[i]-'0'; memset(ans,-1,sizeof(ans[0])*(len+1)); cout<<dp(0)<<endl; }return 0;}