Decode the tape

"Machines take me by surprise with great frequency."
Alan Turing

Your boss has just unearthed a roll of old computer tapes. The tapes have holes in them and might contain some sort of useful information. It falls to you to figure out what is written on them.

Input
The input will contain one tape.

Output
Output the message that is written on the tape.

Sample Input Sample Output
___________
| o   .  o|
|  o  .   |
| ooo .  o|
| ooo .o o|
| oo o.  o|
| oo  . oo|
| oo o. oo|
|  o  .   |
| oo  . o |
| ooo . o |
| oo o.ooo|
| ooo .ooo|
| oo o.oo |
|  o  .   |
| oo  .oo |
| oo o.ooo|
| oooo.   |
|  o  .   |
| oo o. o |
| ooo .o o|
| oo o.o o|
| ooo .   |
| ooo . oo|
|  o  .   |
| oo o.ooo|
| ooo .oo |
| oo  .o o|
| ooo . o |
|  o  .   |
| ooo .o  |
| oo o.   |
| oo  .o o|
|  o  .   |
| oo o.o  |
| oo  .  o|
| oooo. o |
| oooo.  o|
|  o  .   |
| oo  .o  |
| oo o.ooo|
| oo  .ooo|
|  o o.oo |
|    o. o |
___________
      
      
      
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <stdio.h>
#include <string.h>
char st[9];
int main()
{
    int i, j, x, k, s, k1;
    gets(st);
    while(gets(st) && st[0]!= '_')
    {
        s = 0;
        j = 6;
        k = strlen(st);
        for(i = 0; i < k; i++)
        {
            if(st[i] == 'o')
            {
                x = 1;
                for(k1 = j; k1 >= 0; k1--)
                {
                    x = x * 2;
                }
                j--;
            }
            else if(st[i] == ' ')
            {
                x = 0;
                j--;
            }
            else
                {
                    x = 0;
                }
                s = s + x;
        }
        printf("%c", s);
    }
    return 0;
}


A quick brown fox jumps over the lazy dog.

你可能感兴趣的:(编程,C语言)