http://ace.delos.com/spring01.htm ... search 4 'krunch'... dis is y u shudnt mess wit Bosco...USA computing olympiad problems in class 10 selexion xamz...n ppl r solvin dem....
Mah solution:
def main():
p = input("Enter string:")
p = krunch(p)
print p
count(p)
def krunch(string):
string=string.replace('a','')
string=string.replace('e','')
string=string.replace('i','')
string=string.replace('o','')
string=string.replace('u','')
string=string.replace(' ',' ')
return string
def count(string):
string=string.lower()
from array import array
alpha = array('i')
for j in range(0,26):
alpha.append(0)
for ch in string:
if(ch!=' '):
alpha[ord(ch)-ord('a')]+=1
for i in range(0,26):
print "Number of ",(unichr(ord('a')+i)),' : ',alpha[i]
I refuze 2 wr8 dis program in java on da grnds dat it jus isnt worth da kynd of tyme n effort required 2 think of da twisted/crzy logic of java...so try 2 undastand it if u can...python aint dat tuff.. also, i THNK dis is da most efficient solushun..but im sure der r a few tweaks dat can b applied, but im jus sik of dis prog... n btw, dis is da last prog im solvin... i am NOT doin da rest of da progs..no matter how hard u beg me..
Peace, Yo!
Friday, January 26, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment