Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<ctype.h>
- #include<string.h>
- int main(){
- int n,ans=1;
- char str[27],a[1000],b[1000];
- gets(str);
- for(int i = 0;; i++){
- gets(a);
- if(a[0]=='e' && a[1]=='n' && a[2]=='d'){
- break;
- }
- else if(ans==0){
- break;
- }
- ans=0;
- int len=strlen(a);
- for(int j=0;j<len;j++){
- for(int c=0;c<26;c++){
- if(a[j]==str[c]){
- ans = ans+c+1;
- }
- }
- }
- printf("%d\n",ans);
- memset(a,0,len);
- }
- for(int i = 0; scanf("%d",&n) != EOF; i++){
- gets(b);
- memset(b,0,strlen(b));
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment