#include<iostream> #include<cstring> using namespace std; int main(){ string s1,s2; while(cin>>s1>>s2){ int a=s1.at(0),b=s2.at(0); int k; if(b>=a) k=b-a; else k=26-(a-b); cout<<k<<endl; } }
#include #include using namespace std; int main(){ string s1,s2; while(cin>>s1>>s2){ int a=s1.at(0),b=s2.at(0); int k; if(b>=a) k=b-a; else k=26-(a-b); cout<<k<<endl; } }
#include <bits/stdc++.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
string a,b;
while(cin>>a>>b){
if(b[0]>=a[0])cout<<(b[0]-a[0])<<endl;
else cout<<(b[0]-a[0]+26)<<endl;
}
return 0;
}
#include #include using namespace std; int main(){ string s1,s2; while(cin>>s1>>s2){ int a=s1.at(0),b=s2.at(0); int k; if(b>=a) k=b-a; else k=26-(a-b); cout<<k<<endl; } }
#include <bits/stdc++.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
string a,b;
while(cin>>a>>b){
if(b[0]>=a[0])cout<<(b[0]-a[0])<<endl;
else cout<<(b[0]-a[0]+26)<<endl;
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main(){
string a,b;
while(cin>>a>>b)
cout<<(b[0]-a[0]+26)%26<<endl;
}
這樣更短喔!