//凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ #include<stdio.h> #define N 1000 void main(){ ]; ,n,state; //num 用来统计单词的个数 //state 用来记录程序当前是否处于一个单词之中,初值为0,表示不在单词中,值为1,表示正处于在一个单词中 printf("Please input the number of lines for English passage:"
/** *判断字符类型 */ function CharMode(iN) { if (iN >= 48 && iN <= 57) //数字 return 1; if (iN >= 65 && iN <= 90) //大写字母 return 2; if (iN >= 97 && iN <= 122) //小写 return 4; else return 8; //特殊字符 } /** * 统计字符类型 */ function
Problem F. String Input file: standard input Output file: standard output Time limit: 1 seconds Memory limit: 128 megabytes 大家都知道马大佬很皮 马大佬很喜欢 ICPC,马大佬现在手里有 n 块积木,每一个积木是 a 到 z,26 个英文字母 中的一个,现在马大佬想
这里用到了三个函数: #判断是否为数字:str.isdigit()#是否为字母:str.isalpha()#是否为空格:str.isspace() def tongji(str): alpha = 0 number = 0 space =0 qt = 0 for i in range(len(str)): #或者for i in str: if str[i].isalpha(): #接上一句改为:i.isalpha() alpha += 1 elif str[i].isdigit(): numb
一.字符串操作: 解析身份证号:生日.性别.出生地等. 凯撒密码编码与解码 网址观察与批量生成 2.凯撒密码编码与解码 凯撒加密法的替换方法是通过排列明文和密文字母表,密文字母表示通过将明文字母表向左或向右移动一个固定数目的位置.例如,当偏移量是左移3的时候(解密时的密钥就是3),所有的字母A将被替换成D,B变成E,以此类推X将变成A,Y变成B,Z变成C.由此可见,位数就是凯撒密码加密和解密的密钥. def change(c,i): c = c.lower() num = ord(c) if n