---
# System prepended metadata

title: 13309 - How much is the string worth 2
tags: [string]

---

# 13309 - How much is the string worth 2
>author: Utin
###### tags: `string`

---

## Brief
See the code below

## Solution 0

```c=
#include <stdio.h>
#include <string.h>

char c[29], s[101];

int indexOf(char target) {
    for(int i=0; i<26; i++) {
        if(target == c[i]) return i+1;
    }
    return 0;
}

int check(int l) {
    if(s[0] == '0' && l == 2) return 1;
    else if(s[0] == 'e' && s[1] == 'n' && s[2] == 'd' && l == 4) return 1;
    else return 0;
}

int main() {
    fgets(c, 28, stdin);
    while (fgets(s, 100, stdin) != EOF) {
        int length = strlen(s);
        if(check(length) == 1) {
            break;
        }
        int sum = 0;
        for(int i=0; i<length-1; i++) {
            sum += indexOf(s[i]);
        }
        printf("%d\n", sum);
    }
}

// By Utin
```

## Reference