pythonchallenge 【第2题】

新博客地址:http://gorthon.sinaapp.com/

http://www.pythonchallenge.com/pc/def/ocr.html

先查看源码,得到那个长的客串

>>> import string >>> a = """%%$@_$^__#)^)&!_+]!*@&^}@[@%]()%+mce_marker[(_……""" # 后面省略 >>> ''.join([i for i in a if i in string.letters]) 'equality' >>>  

###################################################

处理那个长字符串的时候可以先用python处理一下:

 

a = """asdfdsfasd………………"""

f = file('./t.txt', 'a')

print len(a)

for i in a:

    i+='///n'

    f.write(i)

 

这样直接复制txt里面到c++的字符串就可以了。

C++版本:

#include <iostream> #include <string.h> using namespace std; int main(void) { string a = "%%$@_$^__#)^)&………………"; for(int i=0; i<a.size(); i++) if(96<a[i] && a[i]<123) cout << a[i]; return 0; } 

结果:

equality

Process returned 0 (0x0)   execution time : 0.406 s

Press any key to continue.

 

你可能感兴趣的:(pythonchallenge 【第2题】)