解碼的依據就是二進位的ASCII碼。
C++(0.016)
/*******************************************************/
/* UVa 10878 Decode the tape */
/* Author: Maplewing [at] knightzone.studio */
/* Version: 2012/01/17 */
/*******************************************************/
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
string s;
int ASCII;
while( getline( cin, s ) ){
if( s[0] == '_' )
continue;
ASCII = 0;
for( int i = 0 ; i < s.length() ; i++ )
if( s[i] == ' ' )
ASCII *= 2;
else if( s[i] == 'o' )
ASCII = ASCII * 2 + 1;
printf( "%c", ASCII );
}
return 0;
}