int password(char v,char c){
if(c-v>0){
return c-v;
}else{
return (c-v)*-1;
}
}
int main(int argc, char** argv) {
cout<<"輸入只有一行,含有 7 個相連的大寫英文字母"<<endl;
char a1,a2,a3,a4,a5,a6,a7;
cin>>a1>>a2>>a3>>a4>>a5>>a6>>a7;
//解法1
char aa[7];
aa[0]=a1;
aa[1]=a2;
aa[2]=a3;
aa[3]=a4;
aa[4]=a5;
aa[5]=a6;
aa[6]=a7;
for(int i=0;i<6;i++){
cout<<password(aa[i+1],aa[i])<<"";
}
//解法2
if(a2-a1>0){
cout<<a2-a1<<" ";
}else{
cout<<(a2-a1)*-1<<" ";
}
if(a3-a2>0){
cout<<a3-a2<<" ";
}else{
cout<<(a3-a2)*-1<<" ";
}
if(a4-a3>0){
cout<<a4-a3<<" ";
}else{
cout<<(a4-a3)*-1<<" ";
}
if(a5-a4>0){
cout<<a5-a4<<" ";
}else{
cout<<(a5-a4)*-1<<" ";
}
if(a6-a5>0){
cout<<a6-a5<<" ";
}else{
cout<<(a6-a5)*-1<<" ";
}
if(a7-a6>0){
cout<<a7-a6<<" ";
}else{
cout<<(a7-a6)*-1<<" ";
}