buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
$stdin = DATA if $stdin.eof? appear_count = Hash.new(0) ARGF.each_line do |line| line.downcase.each_char.group_by{|c| c}.map{|k, arr| appear_count[k] += arr.size} end ('a'..'z').each do |c| p "#{c} : #{appear_count[c]}" end __END__ This is a pen. zzzz
$stdin = DATA if $stdin.eof? appear_count = Hash.new(0) ARGF.each_line do |line| line.downcase.each_char.group_by{|c| c}.map{|k, arr| appear_count[k] += arr.size} end ('a'..'z').each do |c| puts "#{c} : #{appear_count[c]}" end __END__ This is a pen. zzzz
[["-", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22], ["+", 0, 652, 196, 737, 8, 736, 0, 652, 735, 22]]
4
84
str = gets ('a'..'z').each do |alphabet| puts "#{alphabet} : #{str.count(alphabet)}" end
str = gets(nil).downcase ('a'..'z').each do |alphabet| puts"#{alphabet} : #{str.count(alphabet)}" end
[["+", 12, 652, 486, 652, 3, 4, 0, 477, 0, 477], ["+", 0, 662, 12, 652, 486, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 652, 486, 739, 0, 24]]
4
34
lines = [] while true line = STDIN.gets.chomp if line.length == 0 then break end lines << line end line = lines.join ("") # puts line element = line.downcase.chars.group_by{ |item| item.chr } # p element for c in "a".."z" do output = 0 if element[c] != nil then output = element[c].length end...
lines = [] while true line = STDIN.gets if line == nil then break end lines << line end line = lines.join ("") # puts line element = line.downcase.chars.group_by{ |item| item.chr } # p element for c in "a".."z" do output = 0 if element[c] != nil then output = element[c].length end puts "#{...
[["-", 0, 89, 8, 170, 0, 662, 12, 652, 17, 131], ["-", 0, 89, 8, 170, 0, 662, 12, 652, 735, 22], ["-", 8, 170, 0, 121, 15, 738, 31, 652, 17, 131], ["-", 8, 170, 0, 121, 15, 738, 31, 652, 735, 22], ["-", 0, 89, 8, 170, 0, 121, 15, 738, 12, 612], ["+", 8, 170, 0, 121, 15, 738, 12, 477, 0, 477]]
4
96
y = {} (:a..:z).each do |i| y[i] = 0 end loop do x = gets if x == nil break end x.gsub!(/[^a-zA-Z]/,"").downcase.split(//) x.each do |i| y[:"#{i}"] += 1 end end y.each do |k,v| puts "#{k} : #{v}" end
y = {} (:a..:z).each do |i| y[i] = 0 end loop do x = gets if x == nil break end z = x.gsub(/[^a-zA-Z]/,"").downcase.split(//) z.each do |i| y[:"#{i}"] += 1 end end y.each do |k,v| puts "#{k} : #{v}" end
[["+", 0, 652, 196, 737, 8, 736, 0, 662, 31, 22], ["+", 0, 652, 196, 737, 8, 736, 0, 662, 0, 32], ["-", 8, 736, 0, 652, 486, 652, 486, 652, 735, 22], ["+", 0, 662, 12, 652, 486, 652, 486, 652, 735, 22], ["-", 0, 652, 196, 737, 8, 736, 0, 652, 486, 22], ["+", 0, 652, 196, 737, 8, 736, 0, 652, 486, 22]]
4
91
s = "" while (line = gets.chomp) == "" s += line end a_ord = "a".ord len = "z".ord - a_ord + 1 table = Array.new(len) { 0 } s.downcase.chars.select {|x| x =~ /[a-z]/ }.map {|x| x.ord - a_ord }.each {|x| table[x] += 1 } len.times {|x| puts "#{(x + a_ord).chr} : #{table[x]}" }
s = "" while (line = gets) s += line end a_ord = "a".ord len = "z".ord - a_ord + 1 table = Array.new(len) { 0 } s.downcase.chars.select {|x| x =~ /[a-z]/ }.map {|x| x.ord - a_ord }.each {|x| table[x] += 1 } len.times {|x| puts "#{(x + a_ord).chr} : #{table[x]}" }
[["-", 15, 738, 31, 739, 0, 662, 12, 652, 17, 131], ["-", 15, 738, 31, 739, 0, 662, 12, 652, 735, 22], ["-", 36, 36, 0, 493, 0, 89, 15, 738, 17, 60], ["-", 0, 493, 0, 89, 15, 738, 12, 557, 0, 62]]
4
117
str = ""; while s = gets do str << s.chomp; end for c in 'a'..'z' do puts c + " : " + str.count(c).to_s; end
str = ""; while s = gets do str << s.chomp; end str.downcase!; for c in 'a'..'z' do puts c + " : " + str.count(c).to_s; end
[["+", 36, 36, 36, 36, 0, 493, 0, 652, 486, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 17, 131], ["+", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["+", 36, 36, 36, 36, 36, 36, 0, 493, 0, 35]]
4
45
g = STDIN.read t = [*?a..?z].map{|alpha| [alpha, g.count(alpha) + g.count(alpha.swapcase)]} t.each{|x,y| puts x + ' : ' + y}
g = STDIN.read t = [*?a..?z].map{|alpha| [alpha, g.count(alpha) + g.count(alpha.swapcase)]} t.each{|x,y| puts x + ' : ' + y.to_s}
[["+", 0, 652, 3, 4, 0, 738, 12, 652, 17, 131], ["+", 0, 652, 3, 4, 0, 738, 12, 652, 735, 22]]
4
57
#!/usr/bin/ruby # -*- coding: utf-8 -*- =begin ITP1_8-C Character - Counting Characters Time Limit : 1 sec, Memory Limit : 65536 KB ????????????????????? ?????????????????±??????????????????????????¢???????????????????????°?????°??????????????°????????????????????????????????? ??????????°?????????¨??§??????????????\...
#!/usr/bin/ruby # -*- coding: utf-8 -*- =begin ITP1_8-C Character - Counting Characters Time Limit : 1 sec, Memory Limit : 65536 KB ????????????????????? ?????????????????±??????????????????????????¢???????????????????????°?????°??????????????°????????????????????????????????? ??????????°?????????¨??§??????????????\...
[["-", 0, 493, 0, 89, 8, 170, 0, 652, 735, 22], ["-", 0, 89, 8, 170, 0, 652, 3, 4, 0, 22]]
4
116
str = $stdin.readlines.chomp.downcase puts [*?a..?z].map{ |c| "#{c} : #{str.count(c)}" }
str = $stdin.read.chomp.downcase puts [*?a..?z].map{ |c| "#{c} : #{str.count(c)}" }
[["-", 0, 662, 12, 652, 486, 652, 486, 652, 735, 22], ["+", 0, 662, 12, 652, 486, 652, 486, 652, 735, 22]]
4
37
text = " " while line = gets text += line.chomp.douncase end res = {} for c in 'a'..'z' res[c] = text.count(c) end res.each do |k,v| puts k + " : " + v.to_s end
text = " " while line = gets text += line.chomp.downcase end res = {} for c in 'a'..'z' res[c] = text.count(c) end res.each do |k,v| puts k + " : " + v.to_s end
[["-", 0, 89, 8, 170, 0, 755, 12, 652, 735, 22], ["+", 0, 89, 8, 170, 0, 755, 12, 652, 735, 22]]
4
63
lines = $stdin.read array = lines.chomp.downcase.each_codepoint.to_a sum_h = (96..122).to_a.map{ |c| [c, 0]}.to_h array.each{|i| sum_h[i] += 1 unless sum_h[i].nil? } sum_h.sort.select{|k,v| 96 < k && k < 123 }.map do |k,v| puts "#{k.chr}: #{v}" end
lines = $stdin.read array = lines.chomp.downcase.each_codepoint.to_a sum_h = (96..122).to_a.map{ |c| [c, 0]}.to_h array.each{|i| sum_h[i] += 1 unless sum_h[i].nil? } sum_h.sort.select{|k,v| 96 < k && k < 123 }.map do |k,v| puts "#{k.chr} : #{v}" end
[["-", 8, 736, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 8, 736, 0, 652, 3, 4, 0, 557, 0, 6]]
4
100
sum={} while x=gets.downcase x.length.times{|i|sum[x[i]]!=nil ? sum[x[i]]+=1 : sum[x[i]]=1} end [*'a'..'z'].each{|i|puts i+" : "+sum[i].to_s if sum[i] != nil puts i+" : 0" if sum[i] == nil}
sum={} while a=gets x=a.downcase x.length.times{|i|sum[x[i]]!=nil ? sum[x[i]]+=1 : sum[x[i]]=1} end [*'a'..'z'].each{|i|puts i+" : "+sum[i].to_s if sum[i] != nil puts i+" : 0" if sum[i] == nil}
[["-", 36, 36, 0, 493, 0, 89, 15, 662, 31, 22], ["+", 36, 36, 0, 493, 0, 89, 15, 662, 31, 22], ["+", 0, 493, 0, 89, 8, 170, 0, 662, 31, 22], ["+", 0, 493, 0, 89, 8, 170, 0, 662, 0, 32], ["+", 0, 89, 8, 170, 0, 662, 12, 652, 486, 22]]
4
100
while str = gets chars += str.downcase end ('a'..'z').each do |letter| # puts chars.count(letter) puts "#{ letter } : #{ chars.count(letter) }" end
chars = "" while str = gets chars += str.downcase end ('a'..'z').each do |letter| # puts chars.count(letter) puts "#{ letter } : #{ chars.count(letter) }" end
[["+", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["+", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["+", 36, 36, 0, 493, 0, 662, 12, 557, 0, 62]]
4
42
a = ("a".."z").to_a b = Array.new(26, 0) while x = gets.downcase x.chars { |i| for j in 0..25 i == a[j] && b[j] += 1 end } end a.size.times { |c| puts "#{a[c]} : #{b[c]}" }
a = ("a".."z").to_a b = Array.new(26, 0) while x = gets x = x.downcase x.chars { |i| for j in 0..25 i == a[j] && b[j] += 1 end } end a.size.times { |c| puts "#{a[c]} : #{b[c]}" }
[["+", 0, 493, 0, 89, 8, 170, 0, 662, 31, 22], ["+", 0, 493, 0, 89, 8, 170, 0, 662, 0, 32], ["+", 0, 89, 8, 170, 0, 662, 12, 652, 486, 22]]
4
84
a = ("a".."z").to_a b = Array.new(26, 0) while x = gets.chomp.downcase x.chars { |i| for j in 0..25 i == a[j] && b[j] += 1 end } end a.size.times { |c| puts "#{a[c]} : #{b[c]}" }
a = ("a".."z").to_a b = Array.new(26, 0) while x = gets x.downcase.chars { |i| for j in 0..25 i == a[j] && b[j] += 1 end } end a.size.times { |c| puts "#{a[c]} : #{b[c]}" }
[["-", 0, 89, 15, 662, 12, 652, 486, 652, 17, 131], ["-", 0, 89, 15, 662, 12, 652, 486, 652, 735, 22], ["+", 0, 89, 8, 170, 0, 652, 486, 652, 486, 22], ["-", 0, 493, 0, 89, 8, 170, 0, 652, 486, 22]]
4
86
chrs = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] array = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] while true do str = gets.chomp.downcase break if str.length == 0 chrs.each_with_ind...
chrs = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] array = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] while str = gets do str = str.chomp.downcase break if str.length == 0 chrs.each_wit...
[["-", 36, 36, 36, 36, 0, 493, 0, 89, 15, 146], ["-", 36, 36, 0, 493, 0, 89, 8, 170, 0, 170], ["+", 36, 36, 0, 493, 0, 89, 8, 170, 0, 170], ["+", 0, 493, 0, 89, 8, 170, 0, 662, 31, 22], ["+", 0, 493, 0, 89, 8, 170, 0, 662, 0, 32], ["+", 8, 170, 0, 662, 12, 652, 486, 652, 486, 22]]
4
224
dict = { 'a' => 0, 'b' => 0, 'c' => 0, 'd' => 0, 'e' => 0, 'f' => 0, 'g' => 0, 'h' => 0, 'i' => 0, 'j' => 0, 'k' => 0, 'l' => 0, 'm' => 0, 'n' => 0, 'o' => 0, 'p' => 0, 'q' => 0, 'r' => 0, 's' => 0, 't' => 0, 'u' => 0, 'v' => 0, 'w' => 0, 'x' => 0, 'y' => 0, 'z' => 0 } while true ...
dict = { 'a' => 0, 'b' => 0, 'c' => 0, 'd' => 0, 'e' => 0, 'f' => 0, 'g' => 0, 'h' => 0, 'i' => 0, 'j' => 0, 'k' => 0, 'l' => 0, 'm' => 0, 'n' => 0, 'o' => 0, 'p' => 0, 'q' => 0, 'r' => 0, 's' => 0, 't' => 0, 'u' => 0, 'v' => 0, 'w' => 0, 'x' => 0, 'y' => 0, 'z' => 0 } while STDIN.eof ==...
[["-", 36, 36, 36, 36, 0, 493, 0, 89, 15, 146], ["+", 0, 493, 0, 89, 15, 738, 31, 652, 486, 743], ["+", 0, 493, 0, 89, 15, 738, 31, 652, 17, 131], ["+", 0, 493, 0, 89, 15, 738, 31, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 89, 15, 738, 17, 60], ["+", 36, 36, 0, 493, 0, 89, 15, 738, 12, 147]]
4
222
w='' loop {w += gets.chomp.downcase} [*'a'..'z'].each{|c|puts c+' : '+w.count(c).to_s}
w='' loop do begin w += gets.chomp.downcase rescue break end end [*'a'..'z'].each{|c|puts c+' : '+w.count(c).to_s}
[["-", 36, 36, 0, 493, 0, 652, 196, 196, 0, 45], ["+", 36, 36, 0, 493, 0, 652, 196, 737, 0, 170], ["+", 0, 652, 196, 737, 8, 736, 0, 756, 0, 756], ["-", 36, 36, 0, 493, 0, 652, 196, 196, 0, 46], ["+", 196, 737, 8, 736, 0, 756, 0, 764, 0, 764], ["+", 0, 756, 0, 764, 8, 749, 0, 94, 0, 94], ["+", 0, 652, 196, 737, 8, 736,...
4
46
import sys s = "" for line in sys.stdin: s+=line s.lower() for str in list("abcdefghijklmnopqrstuvwxyz"): print(*[str,":",s.count(str)])
import sys s = "" for line in sys.stdin: s+=line s=s.lower() for str in list("abcdefghijklmnopqrstuvwxyz"): print(*[str,":",s.count(str)])
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22]]
5
49
alp_count = [0]*26 string = open(0).read() string = string.lower() alp = [chr(ord("a")+i) for i in range(26)] c = 0 for j in range(26): c = string.count(alp[j]) alp_count[j] += c print("%s : %d\n"%(alp[j],alp_count[j]))
alp_count = [0]*26 string = open(0).read() string = string.lower() alp = [chr(ord("a")+i) for i in range(26)] c = 0 for j in range(26): c = string.count(alp[j]) alp_count[j] += c print("%s : %d"%(alp[j],alp_count[j]))
[["-", 3, 4, 0, 657, 31, 557, 0, 6, 0, 44]]
5
93
import sys s = sys.stdin.read() for i in range(26): s.count(chr(97+i)) print(chr(97+i)+" : "+str(s.count(chr(97+i))))
import sys s=sys.stdin.read().lower() for i in range(26): s.count(chr(97+i)) print(chr(97+i)+" : "+str(s.count(chr(97+i))))
[["+", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
58
import sys import string count = {k : 0 for k in string.ascii_lowercase} print(count) for c in sys.stdin.read().lower(): if c.islower(): count[c] = count[c] + 1 for k, v in count.items(): print(f"{k} : {v}")
import sys import string count = {k : 0 for k in string.ascii_lowercase} for c in sys.stdin.read().lower(): if c.islower(): count[c] = count[c] + 1 for k, v in count.items(): print(f"{k} : {v}")
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
77
import sys l = "" for i in sys.stdin.readlines(): l += i.lower().rstrip() word = "abcdefghijklmnopqrstuvwxyz" for i in word: n = l.count(i) print("{}:{}".format(i,n))
import sys l = "" for i in sys.stdin.readlines(): l += i.lower().rstrip() word = "abcdefghijklmnopqrstuvwxyz" for i in word: n = l.count(i) print("{} : {}".format(i,n))
[["-", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6], ["+", 3, 4, 0, 652, 63, 319, 500, 557, 0, 6]]
5
59
a = "abcdefghijklmnopqrstuvwxyz" while 1: try: b += input().lower() except: break for i in range(26): print(a[i],':',b.count(a[i]))
a = "abcdefghijklmnopqrstuvwxyz" b = '' while 1: try: b += input().lower() except: break for i in range(26): print(a[i],':',b.count(a[i]))
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 1, 0, 662, 12, 557, 0, 654], ["+", 0, 656, 0, 1, 0, 662, 12, 557, 0, 655]]
5
51
s = "" while True: try: x = input() except: break s += x for i in range(26): c = chr(i + ord('a')) print(('%s : %d' %(c, s.count(c))))
s = "" while True: try: x = input().lower() except: break s += x for i in range(26): c = chr(i + ord('a')) print(('%s : %d' %(c, s.count(c))))
[["+", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
60
import sys; Dic={'a':0,'b':0,'c':0,'d':0,'e':0,'f':0,'g':0,'h':0,'i':0,'j':0,'k':0,'l':0,'m':0,'n':0,'o':0,'p':0,'q':0,'r':0,'s':0,'t':0,'u':0,'v':0,'w':0,'x':0,'y':0,'z':0 } while True: lit=sys.stdin.readline().rstrip() if not lit: break for i in lit: if ord('a')<=ord(i)<=ord('z'): Dic[i]+=1 Key=sorted(list(Di...
import sys; Dic={'a':0,'b':0,'c':0,'d':0,'e':0,'f':0,'g':0,'h':0,'i':0,'j':0,'k':0,'l':0,'m':0,'n':0,'o':0,'p':0,'q':0,'r':0,'s':0,'t':0,'u':0,'v':0,'w':0,'x':0,'y':0,'z':0 } while True: lit=sys.stdin.readline().rstrip().lower() if not lit: break for i in lit: if ord('a')<=ord(i)<=ord('z'): Dic[i]+=1 Key=sorted...
[["+", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
245
import string count = {x: 0 for x in string. ascii_lowercase} lines = "" while True: try: lines += input().lower() except EOFError: break for c in lines: if 'a' <= c <= 'z': count[c] += 1 for key, num in ascii_lowercase: print("{0} : {1}".format(key, count[key]))
import string count = {x: 0 for x in string.ascii_lowercase} lines = "" while True: try: lines += input().lower() except EOFError: break for c in lines: if 'a' <= c <= 'z': count[c] += 1 for key in string.ascii_lowercase: print("{0} : {1}".format(k...
[["-", 36, 36, 0, 656, 0, 7, 31, 684, 0, 21], ["-", 36, 36, 0, 656, 0, 7, 31, 684, 0, 22], ["+", 36, 36, 0, 656, 0, 7, 12, 319, 500, 22], ["+", 36, 36, 0, 656, 0, 7, 12, 319, 0, 131]]
5
82
import sys data = 'abcdefghijklmnopqrstuvwxyz' for line in sys.stdin: sentence += line.lower() for i in data: print(i + ' : ' + str(sentence.count(i)))
import sys sentence = '' data = 'abcdefghijklmnopqrstuvwxyz' for line in sys.stdin: sentence += line.lower() for i in data: print(i + ' : ' + str(sentence.count(i)))
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 1, 0, 662, 12, 557, 0, 654], ["+", 0, 656, 0, 1, 0, 662, 12, 557, 0, 655]]
5
44
text = '' while True: s = input().lower() if s == '': break text += s for i in 'abcdefghijklmnopqrstuvwxyz': print(i+' : '+str(text.count(i))) #print("{0} : {1}".format(i, text.count(i)))
text = '' while True: try: s = input().lower() except EOFError: break if s == '': break text += s for i in 'abcdefghijklmnopqrstuvwxyz': print(i+' : '+str(text.count(i))) #print("{0} : {1}".format(i, text.count(i)))
[["+", 0, 656, 0, 52, 8, 196, 0, 246, 0, 247], ["+", 0, 656, 0, 52, 8, 196, 0, 246, 0, 102], ["+", 0, 52, 8, 196, 0, 246, 0, 671, 0, 672], ["+", 0, 52, 8, 196, 0, 246, 0, 671, 0, 22], ["+", 0, 52, 8, 196, 0, 246, 0, 671, 0, 102], ["+", 0, 246, 0, 671, 0, 196, 0, 93, 0, 94]]
5
52
import sys a = sys.stdin.readline alphabet = "abcdefghijklmnopqrstuvwxyz" for i in alphabet: print(i + " : " + str(a.lower().count(i)) )
import sys a = sys.stdin.read() alphabet = "abcdefghijklmnopqrstuvwxyz" for i in alphabet: print(i + " : " + str(a.lower().count(i)) )
[["-", 0, 656, 0, 1, 0, 662, 12, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
41
import sys #fin = open("test.txt", "r") fin = sys.stdin sentence = fin.readline() sentence = sentence.lower() num_alphabet_list = [0 for i in range(27)] for c in sentence: if ord(c) < ord('a') or ord(c) > ord('z'): continue num_alphabet_list[ord(c) - ord('a')] += 1 for i in range(0, 27): print(chr(i + ord('a...
import sys #fin = open("test.txt", "r") fin = sys.stdin sentence = fin.read() sentence = sentence.lower() num_alphabet_list = [0 for i in range(26)] for c in sentence: if ord(c) < ord('a') or ord(c) > ord('z'): continue num_alphabet_list[ord(c) - ord('a')] += 1 for i in range(0, 26): print(chr(i + ord('a')),...
[["-", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
128
s = "" while True: try: s += input() except: break l = list(s) alphabet = list("abcdefghijklmnopqrstuvwxyz") c = [l.count(alphabet[i]) for i in range(26)] for i in range(26): print("{} : {}".format(alphabet[i],c[i]))
s = "" while True: try: s += input() except: break l = list(s.lower()) alphabet = list("abcdefghijklmnopqrstuvwxyz") c = [l.count(alphabet[i]) for i in range(26)] for i in range(26): print("{} : {}".format(alphabet[i],c[i]))
[["+", 12, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 12, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
78
import sys s = sys.stdin.read().lower() for i in range (ord('a'), ord('z')+1): print(str(chr(i)), str(s.count(chr(i))), sep=':')
import sys s = sys.stdin.read().lower() for i in range (ord('a'), ord('z')+1): print(str(chr(i)), str(s.count(chr(i))), sep=' : ')
[["-", 0, 652, 3, 4, 0, 653, 51, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 653, 51, 557, 0, 6]]
5
66
text = input() count = int(input()) for c in range(count): args = input().split() (a, b) = [int(x) for x in args[1:3]] if args[0] == 'print': print(text[a:b + 1]) elif args[0] == 'reverse': text = text[0:a] + text[a:b + 1][::-1] + text[b + 1:] elif args[0] == 'replace': tex...
text = input() count = int(input()) for c in range(count): args = input().split() (a, b) = [int(x) for x in args[1:3]] if args[0] == 'print': print(text[a:b + 1]) elif args[0] == 'reverse': text = text[0:a] + text[a:b + 1][::-1] + text[b + 1:] elif args[0] == 'replace': tex...
[["+", 0, 662, 12, 657, 12, 206, 206, 663, 0, 102]]
5
143
text = input() count = int(input()) for c in range(count): args = input().split() (a,b) = [int(x) for x in args[1:3]] if args[0] == 'print': print(text[a:b + 1]) elif args[0] == 'reverse': text = text[0:a] + text[a:b][::-1] + text[b + 1:] elif args[0] == 'replace': text = te...
text = input() count = int(input()) for c in range(count): args = input().split() (a, b) = [int(x) for x in args[1:3]] if args[0] == 'print': print(text[a:b + 1]) elif args[0] == 'reverse': text = text[0:a] + text[a:b + 1][::-1] + text[b + 1:] elif args[0] == 'replace': text...
[["+", 12, 206, 51, 206, 206, 663, 0, 657, 17, 72], ["+", 12, 206, 51, 206, 206, 663, 0, 657, 12, 612]]
5
142
s = input() q = int(input()) for i in range(q): command = input().split() a, b = int(command[1]), int(command[2]) + 1 if command[0] == "print": print(s[a:b]) elif command[0] == "reverse": s = s[:a] + s[a:b:-1] + s[b:] elif command[0] == "replace": s = s[:a] + command[3] + s[b...
s = input() q = int(input()) for i in range(q): command = input().split() a, b = int(command[1]), int(command[2]) + 1 if command[0] == "print": print(s[a:b]) elif command[0] == "reverse": s = s[:a] + s[a:b][::-1] + s[b:] elif command[0] == "replace": s = s[:a] + command[3] + ...
[["+", 12, 657, 31, 657, 12, 206, 51, 206, 0, 73], ["+", 0, 662, 12, 657, 31, 657, 12, 206, 0, 70], ["+", 12, 657, 31, 657, 12, 206, 206, 663, 0, 102]]
5
131
str = input() q = eval(input()) for ans in range(q): ans = input() ans1 = ans.split(' ') if ans1[0] == 'replace': str = str[0:int(ans1[1])]+ans1[3]+ str[int(ans1[2])+1:len(str)] if ans1[0] == 'reverse': str = str[0:int(ans1[1])]+ans1[3]+ str[int(ans1[1]):int(ans1[2])+1][::-1] + str[int(a...
str = input() q = eval(input()) for ans in range(q): ans = input() ans1 = ans.split(' ') if ans1[0] == 'replace': str = str[0:int(ans1[1])]+ans1[3]+ str[int(ans1[2])+1:len(str)] if ans1[0] == 'reverse': str = str[0:int(ans1[1])]+ str[int(ans1[1]):int(ans1[2])+1][::-1] + str[int(ans1[2])+...
[["-", 12, 657, 31, 657, 31, 657, 12, 206, 51, 22], ["-", 12, 657, 31, 657, 31, 657, 12, 206, 0, 70], ["-", 12, 657, 31, 657, 31, 657, 12, 206, 206, 612], ["-", 12, 657, 31, 657, 31, 657, 12, 206, 0, 73], ["-", 0, 1, 0, 662, 12, 657, 31, 657, 17, 72]]
5
190
#def area############################### def pr(s,a,b): print(s[int(a):int(b)+1]) def rv(s,a,b): tmp=s[::-1] news=s[:int(a)]+tmp[len(tmp)-int(b)-1:len(tmp)-int(a)]+s[int(b)+1:] return news def rp(s,a,b,p): news=s[:int(a)]+p+s[int(b)+1:] return news ######################################## I=input() n=int(eval(...
#def area############################### def pr(s,a,b): print(s[int(a):int(b)+1]) def rv(s,a,b): tmp=s[::-1] news=s[:int(a)]+tmp[len(tmp)-int(b)-1:len(tmp)-int(a)]+s[int(b)+1:] return news def rp(s,a,b,p): news=s[:int(a)]+p+s[int(b)+1:] return news ######################################## I=input() n=int(eval(...
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
254
# -*- coding: utf-8 -*- str = input() for _ in range(eval(input())): ops = input().split() na = int(ops[1]) nb = int(ops[2]) + 1 op = ops[0] if op[0]=="p": print(str[na:nb+1]) elif op[2]=="v": str = str[:na] + "".join(reversed(str[na:nb])) + str[nb:] else: str = str[:na] + ops[3] + str[nb:]
# -*- coding: utf-8 -*- str = input() for _ in range(eval(input())): ops = input().split() na = int(ops[1]) nb = int(ops[2]) + 1 op = ops[0] if op[0]=="p": print(str[na:nb]) elif op[2]=="v": str = str[:na] + "".join(reversed(str[na:nb])) + str[nb:] else: str = str[:na] + ops[3] + str[nb:]
[["-", 3, 4, 0, 206, 206, 663, 0, 657, 17, 72], ["-", 3, 4, 0, 206, 206, 663, 0, 657, 12, 612]]
5
134
s = input() n = int(input()) for i in range(n): p = input().split() a, b = [int(x) for x in p[1:3]] if p[0]=="print": print(s[a:b+1]) if p[0]=="replace": s = s[:a] + p[3] + s[b+1:] if p[0]=="reverse": s = s[:a] + s[a:b+1:-1] + s[b+1:]
s = input() n = int(input()) for i in range(n): p = input().split() a, b = [int(x) for x in p[1:3]] if p[0]=="print": print(s[a:b+1]) elif p[0]=="replace": s = s[:a] + p[3] + s[b+1:] elif p[0]=="reverse": s = s[:a] + s[a:b+1][::-1] + s[b+1:]
[["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 12, 657, 31, 657, 12, 206, 51, 206, 0, 73], ["+", 0, 662, 12, 657, 31, 657, 12, 206, 0, 70], ["+", 12, 657, 31, 657, 12, 206, 206, 663, 0, 102]]
5
137
string = input() q = int(input()) for c in range(0,q): instruction = input().split(' ') if instruction[0] == 'print': print(string[int(instruction[1]):int(instruction[2]) + 1]) elif instruction[0] == 'reverse': string = string.replace(string[int(instruction[1]):int(instruction[2])+1], string...
string = input() q = int(input()) for c in range(0,q): instruction = input().split(' ') if instruction[0] == 'print': print(string[int(instruction[1]):int(instruction[2]) + 1]) elif instruction[0] == 'reverse': string = string.replace(string[int(instruction[1]):int(instruction[2])+1], string...
[["-", 0, 657, 31, 652, 3, 4, 0, 206, 206, 612], ["+", 0, 657, 31, 652, 3, 4, 0, 206, 206, 612]]
5
176
#!usr/bin/env python3 import sys def main(): s = sys.stdin.readline().strip('\n') q = int(sys.stdin.readline().strip('\n')) for instruction in range(q): words = [word for word in sys.stdin.readline().strip('\n').split()] print(words) if words[0] == 'replace': s = s[:i...
#!usr/bin/env python3 import sys def main(): s = sys.stdin.readline().strip('\n') q = int(sys.stdin.readline().strip('\n')) for instruction in range(q): words = [word for word in sys.stdin.readline().strip('\n').split()] if words[0] == 'replace': s = s[:int(words[1])] + words...
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
235
# -*- coding: utf-8 -*- from collections import deque n = int(input()) word = deque() for i in range(n): command = list(map(int, input().split())) if command[0] == 0: if command[1] == 0: word.insert(0, command[1]) else: word.append(command[1]) elif command[0] == 1:...
# -*- coding: utf-8 -*- from collections import deque n = int(input()) word = deque() for i in range(n): command = list(map(int, input().split())) if command[0] == 0: if command[1] == 0: word.insert(0, command[2]) else: word.append(command[2]) elif command[0] == 1:...
[["-", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612], ["-", 75, 665, 64, 196, 0, 57, 15, 666, 0, 612], ["+", 75, 665, 64, 196, 0, 57, 15, 666, 0, 612]]
5
134
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <list> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int main() { list<int> lst; list<int>::iterator itr = lst.end(); int n, i, q, x; cin >> n; ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <list> #include <queue> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; int main() { list<int> lst; list<int>::iterator itr = lst.end(); int n, i, q, x; cin >> n; ...
[["+", 75, 76, 0, 7, 15, 16, 12, 2, 63, 22], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 25]]
1
206
#include <algorithm> #include <cmath> #include <iostream> #include <list> #include <map> #include <set> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) int main(void) { int n; int order, value; list<int> l; auto itr = l.end(); cin >> n; for (int i = 0...
#include <algorithm> #include <cmath> #include <iostream> #include <list> #include <map> #include <set> #include <string> #include <vector> using namespace std; #define REP(i, n) for (int i = 0; i < n; i++) int main(void) { int n; int order, value; list<int> l; auto itr = l.end(); cin >> n; for (int i = 0...
[["+", 75, 76, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 75, 76, 0, 7, 10, 43, 49, 50, 0, 32]]
1
188
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; list<int> lst; auto itr = lst.end(); for (int i = 0; i < q; i++) { int a, b; cin >> a; if (a == 0) { cin >> b; lst.insert(itr, b); itr--; } if (a == 1) { cin >> b; if (b >= 0) { ...
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; list<int> lst; auto itr = lst.end(); for (int i = 0; i < q; i++) { int a, b; cin >> a; if (a == 0) { cin >> b; lst.insert(itr, b); itr--; } if (a == 1) { cin >> b; if (b >= 0) { ...
[["+", 0, 9, 0, 7, 15, 16, 12, 2, 63, 22], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 25]]
1
192
#include <iostream> #include <queue> using namespace std; int main() { int n, q, t, x, y; cin >> n >> q; queue<int> a[n]; for (int i = 0; i < q; i++) { cin >> t; if (x == 0) { cin >> x >> y; a[x].push(y); } else if (x == 1) { cin >> x; if (!a[x].empty()) cout << a[x]...
#include <iostream> #include <queue> using namespace std; int main() { int n, q, t, x, y; cin >> n >> q; queue<int> a[n]; for (int i = 0; i < q; i++) { cin >> t; if (t == 0) { cin >> x >> y; a[x].push(y); } else if (t == 1) { cin >> x; if (!a[x].empty()) cout << a[x]...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 31, 22], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 31, 22]]
1
159
#include <stdio.h> #include <stdlib.h> #define VECTOR_INITIAL_CAPACITY 1000 #define push 0 #define access 1 #define pop 2 typedef struct { int size; int capacity; int *data; } Vector; void vector_double_capacity_if_full(Vector *vector) { if (vector->size < vector->capacity) { return; } vector->capac...
#include <stdio.h> #include <stdlib.h> #define VECTOR_INITIAL_CAPACITY 1000 #define push 0 #define access 1 #define pop 2 typedef struct { int size; int capacity; int *data; } Vector; void vector_double_capacity_if_full(Vector *vector) { if (vector->size < vector->capacity) { return; } vector->capac...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22]]
0
451
#include <cstdio> #include <vector> using namespace std; int main() { int q; scanf("%d", &q); vector<int> vi; while (q--) { long long x, k; scanf("%lld", &x); if (x == 2) { if (!vi.empty()) vi.pop_back(); } else if (x == 1) { scanf("%lld", &k); if (!vi.empty()) ...
#include <cstdio> #include <vector> using namespace std; int main() { int q; scanf("%d", &q); vector<long long int> vi; while (q--) { long long x, k; scanf("%lld", &x); if (x == 2) { if (!vi.empty()) vi.pop_back(); } else if (x == 1) { scanf("%lld", &k); if (!vi.empty...
[["+", 39, 344, 3, 347, 0, 77, 39, 86, 0, 96]]
1
140
a, b, c = list(map(int, input().splist())) print('{} {}'.format(min([a,b,c], max([a,b,c]))))
a, b, c = list(map(int, input().split())) print('{} {}'.format(min([a,b,c]), max([a,b,c])))
[["-", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
52
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, q; cin >> n; vector<long> a(n); for (int i = 0; i < n; i++) cin >> a[i]; cin >> q; for (int i = 0; i < q; i++) { int c, b, e; cin >> c >> b >> e; vector<long>::iterator ib = a.begin(), i...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, q; cin >> n; vector<long> a(n); for (int i = 0; i < n; i++) cin >> a[i]; cin >> q; for (int i = 0; i < q; i++) { int c, b, e; cin >> c >> b >> e; vector<long>::iterator ib = a.begin(), i...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
162
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; ++i) cin >> a[i]; int q; cin >> q; while (q--) { int b, e, t; cin >> b >> e >> t; rotate(a.begin() + b, a.begin() + e, a.begin() + t); } for (int i = 0; i < n; ++i) ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; ++i) cin >> a[i]; int q; cin >> q; while (q--) { int b, e, t; cin >> b >> e >> t; swap_ranges(a.begin() + b, a.begin() + e, a.begin() + t); } for (int i = 0; i < n; ++...
[["-", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 52, 8, 9, 0, 1, 0, 2, 63, 22]]
1
141
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int a[1010], b[1010]; int main() { int n, m; cin >> n; rep(i, n) cin >> a[i]; cin >> m; rep(i, m) cin >> b[i]; rep(i, min(n, m)) { if (a[i] > b[i]) { puts("1"); return 0; } if (a[i] < b[i]) { ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int a[1010], b[1010]; int main() { int n, m; cin >> n; rep(i, n) cin >> a[i]; cin >> m; rep(i, m) cin >> b[i]; rep(i, min(n, m)) { if (a[i] > b[i]) { puts("0"); return 0; } if (a[i] < b[i]) { ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
157
#include <stdio.h> int main() { int a, b, c, in[2000], out[2000], ok = 0, i, yes = 1, no = 0; scanf("%d", &a); for (i = 0; i < a; i++) scanf("%d", &in[i]); scanf("%d", &b); for (i = 0; i < b; i++) scanf("%d", &out[i]); c = a; if (b < c) { c = b; } for (i = 0; i < c; i++) { if (out[i] ...
#include <stdio.h> int main() { int a, b, c, in[2000], out[2000], ok = 0, i, yes = 1, no = 1; scanf("%d", &a); for (i = 0; i < a; i++) scanf("%d", &in[i]); scanf("%d", &b); for (i = 0; i < b; i++) scanf("%d", &out[i]); c = a; if (b < c) { c = b; } for (i = 0; i < c; i++) { if (out[i] >...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 57, 64, 57, 15, 339, 51, 16, 17, 20], ["+", 0, 57, 64, 57, 15, 339, 51, 16, 17, 47]]
1
224
n = int(input()) a = list(map(int, input().split())) m = int(input()) b = list(map(int, input().split())) la = len(a) lb = len(b) l = min(la, lb) for i in range(l): if a[i] > b[i]: print(0) break elif a[i] < b[i]: print(1) break else: if la < lb: print(0) else: ...
n = int(input()) a = list(map(int, input().split())) m = int(input()) b = list(map(int, input().split())) la = len(a) lb = len(b) l = min(la, lb) for i in range(l): if a[i] > b[i]: print(0) break elif a[i] < b[i]: print(1) break else: if la >= lb: print(0) else:...
[["-", 75, 76, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 20]]
5
127
#include <stdio.h> #define N 1000 void swap(int a[], int x, int y) { int temp = a[x]; a[x] = a[y]; a[y] = temp; return; } int main() { int n, q, i; int a[N]; int x, y; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &a[i]); scanf("%d", &q); for (i = 0; i < q; i++) { scanf("%d %d...
#include <stdio.h> #define N 1000 void swap(int a[], int x, int y) { int temp = a[x]; a[x] = a[y]; a[y] = temp; return; } int main() { int n, q, i; int a[N]; int x, y; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &a[i]); scanf("%d", &q); for (i = 0; i < q; i++) { scanf("%d %d...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18]]
0
228
#include <algorithm> #include <stdio.h> using namespace std; const int N = 1e3 + 10; int main() { int n, q, l, r, a[N]; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i]); scanf("%d", &q); while (q--) { scanf("%d%d", &l, &r); reverse(a + l, a + r); } printf("%d", a[0]); for (int...
#include <algorithm> #include <stdio.h> using namespace std; const int N = 1e3 + 10; int main() { int n, q, l, r, a[N]; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i]); scanf("%d", &q); while (q--) { scanf("%d%d", &l, &r); reverse(a + l, a + r); } printf("%d", a[0]); for (int...
[["-", 8, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
1
160
#include <bits/stdc++.h> using namespace std; using Int = long long; // INSERT ABOVE HERE signed main() { Int n; cin >> n; vector<Int> a(n); for (Int i = 0; i < n; i++) cin >> a[i]; Int q; cin >> q; for (Int i = 0; i < q; i++) { Int b, e; cin >> b >> e; reverse(a.begin() + b, a.begin() + e...
#include <bits/stdc++.h> using namespace std; using Int = long long; // INSERT ABOVE HERE signed main() { Int n; cin >> n; vector<Int> a(n); for (Int i = 0; i < n; i++) cin >> a[i]; Int q; cin >> q; for (Int i = 0; i < q; i++) { Int b, e; cin >> b >> e; reverse(a.begin() + b, a.begin() + e...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
149
w = gets.chomp cnt = 0 until (line = gets.chomp) == "END_OF_TEXT" line.split(/\W+/).each do |i| cnt += 1 if w == i end end puts cnt
w = gets.chomp.downcase cnt = 0 until (line = gets.chomp) == "END_OF_TEXT" line.split(/\W+/).each do |i| cnt += 1 if w == i.downcase end end puts cnt
[["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22], ["+", 8, 736, 0, 751, 15, 738, 12, 652, 17, 131], ["+", 8, 736, 0, 751, 15, 738, 12, 652, 735, 22]]
4
46
target = gets.chomp.upcase count = 0 until (s = gets) == "END_OF_TEXT" do strs = s.chomp.split 0.upto(strs.size-1) do |i| count += 1 if target == strs[i].upcase end end p count
target = gets.chomp.upcase count = 0 until (s = gets.chomp) == "END_OF_TEXT" do strs = s.split 0.upto(strs.size-1) do |i| count += 1 if target == strs[i].upcase end end p count
[["+", 15, 738, 31, 739, 0, 662, 12, 652, 17, 131], ["+", 15, 738, 31, 739, 0, 662, 12, 652, 735, 22], ["-", 8, 170, 0, 662, 12, 652, 486, 652, 17, 131], ["-", 8, 170, 0, 662, 12, 652, 486, 652, 735, 22]]
4
58
w = gets.chomp res = 0 loop do s = gets.chomp break if s=='END_OF_TEXT' res += s.split.count(w) end puts res
w = gets.chomp.downcase res = 0 loop do s = gets.chomp break if s=='END_OF_TEXT' res += s.downcase.split.count(w) end puts res
[["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 735, 22], ["+", 0, 755, 12, 652, 486, 652, 486, 652, 17, 131], ["+", 0, 755, 12, 652, 486, 652, 486, 652, 735, 22]]
4
35
w=gets.chomp t="" while true str=gets.chomp if str=="END_OF_TEXT" break end t+=str end tsplit=t.split(/\s/) cnt=0 tsplit.each { |item| if item.casecmp(w)==0 cnt+=1 end } puts cnt
w=gets.chomp t="" while true str=gets.chomp if str=="END_OF_TEXT" break end t+=" "+str end tsplit=t.split(" ") cnt=0 tsplit.each { |item| if item.casecmp(w)==0 cnt+=1 end } puts cnt
[["+", 8, 170, 0, 755, 12, 738, 31, 557, 0, 62], ["+", 8, 170, 0, 755, 12, 738, 31, 557, 0, 6], ["+", 0, 89, 8, 170, 0, 755, 12, 738, 17, 72], ["-", 0, 662, 12, 652, 3, 4, 0, 575, 0, 85], ["-", 0, 662, 12, 652, 3, 4, 0, 575, 0, 44], ["+", 0, 662, 12, 652, 3, 4, 0, 557, 0, 62], ["+", 0, 662, 12, 652, 3, 4, 0, 557, 0, 6]...
4
64
word = gets.chomp result = 0 loop do sentence = gets.chomp.split(" ").map do |s| s.to_s end if sentence[0] == "END_OF_TEXT" break else sentence.each do |n| if n == word result += 1 end end end end puts result
word = gets.chomp result = 0 loop do sentence = gets.chomp.split(" ").map do |s| s.to_s end if sentence[0] == "END_OF_TEXT" break else sentence.each do |n| if n.downcase == word result += 1 end end end end puts result
[["+", 8, 736, 0, 121, 15, 738, 31, 652, 17, 131], ["+", 8, 736, 0, 121, 15, 738, 31, 652, 735, 22]]
4
63
word = gets.chomp sentence = Array.new while true do line = gets.chomp if line == "END_OF_TEXT" break end line.split.each do |w| sentence << w end end w = 0 sentence.each do |val| if val == word w += 1 end end puts w
word = gets.chomp sentence = Array.new while true do line = gets.chomp if line == "END_OF_TEXT" break end line.split.each do |w| sentence << w end end w = 0 sentence.each do |val| if val.upcase == word.upcase w += 1 end end puts w
[["+", 8, 736, 0, 121, 15, 738, 31, 652, 17, 131], ["+", 8, 736, 0, 121, 15, 738, 31, 652, 735, 22], ["+", 8, 736, 0, 121, 15, 738, 12, 652, 17, 131], ["+", 8, 736, 0, 121, 15, 738, 12, 652, 735, 22]]
4
61
def count_word(t_array, w) length = t_array.length word_count = 0 for i in 0..(length-1) if t_array[i].downcase == w word_count += 1 end end return word_count end w = gets.chomp t_array = [] loop do t = gets.chomp if t == ["END_OF_TEXT"] break end t_array.push(t) t_array.flatten! ...
def count_word(t_array, w) length = t_array.length word_count = 0 for i in 0..(length-1) if t_array[i].downcase == w word_count += 1 end end return word_count end w = gets.chomp t_array = [] loop do t = gets.chomp.split if t == ["END_OF_TEXT"] break end t_array.push(t) t_array.fla...
[["+", 196, 737, 8, 736, 0, 662, 12, 652, 17, 131], ["+", 196, 737, 8, 736, 0, 662, 12, 652, 735, 22]]
4
85
target_word = gets.chomp.downcase count = 0 while sentense = gets.chomp break if sentense == "END_OF_TEXT" words = sentense.split.downcase count += words.count(target_word) end puts count
target_word = gets.chomp.downcase count = 0 while sentense = gets.chomp break if sentense == "END_OF_TEXT" words = sentense.split.map(&:downcase) count += words.count(target_word) end puts count
[["-", 0, 89, 8, 170, 0, 662, 12, 652, 735, 22], ["+", 0, 89, 8, 170, 0, 662, 12, 652, 735, 22], ["+", 8, 170, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 752, 0, 67], ["+", 0, 662, 12, 652, 3, 4, 0, 752, 0, 753], ["+", 8, 170, 0, 662, 12, 652, 3, 4, 0, 25]]
4
41
word=gets.chomp count=0 while true do l=gets.chomp if l=="END_OF_TEXT" then break end line=l.split for i in 0..line.length-1 do if word==line[i] then count=count+1 end end end puts count
word=gets.chomp count=0 while true do l=gets.chomp if l=="END_OF_TEXT" then break end line=l.split for i in 0..line.length-1 do if word.downcase==line[i].downcase then count=count+1 end end end puts count
[["+", 8, 170, 0, 121, 15, 738, 31, 652, 17, 131], ["+", 8, 170, 0, 121, 15, 738, 31, 652, 735, 22], ["+", 8, 170, 0, 121, 15, 738, 12, 652, 17, 131], ["+", 8, 170, 0, 121, 15, 738, 12, 652, 735, 22]]
4
59
w_line = gets.chomp count = 0 while (t_line = gets.chomp) != "END_OF_TEXT" t = t_line.split(" ") t.each{|str| if w_line == str count += 1 end } end puts count
w_line = gets.downcase.chomp count = 0 while (t_line = gets.chomp) != "END_OF_TEXT" t = t_line.downcase.split(" ") t.each{|str| if w_line == str count += 1 end } end puts count
[["+", 0, 493, 0, 662, 12, 652, 486, 652, 735, 22], ["+", 36, 36, 0, 493, 0, 662, 12, 652, 17, 131], ["+", 8, 170, 0, 662, 12, 652, 486, 652, 17, 131], ["+", 8, 170, 0, 662, 12, 652, 486, 652, 735, 22]]
4
49
s=gets.chomp puts $<.read.downcase.split.count{|l|l[s]}
s=gets.chomp puts $<.read.downcase.split.count{|l|l==s}
[["-", 0, 652, 196, 196, 8, 734, 0, 742, 0, 70], ["+", 0, 652, 196, 196, 8, 734, 0, 738, 17, 60], ["-", 0, 652, 196, 196, 8, 734, 0, 742, 0, 73]]
4
24
ptn = $stdin.gets(chomp:true) str = $stdin.read.downcase puts str.scan(/#{ptn}/).size
ptn = $stdin.gets(chomp:true) str = $stdin.read.downcase puts str.scan(/\b#{ptn}\b/).size
[["+", 0, 652, 486, 652, 3, 4, 0, 575, 0, 44]]
4
30
cnt = 0 word = gets.chomp.downcase until (line = gets.chomp) == "END_OF_TEXT" p line.split.find_all{|it| it.downcase == word }.size end puts cnt
cnt = 0 word = gets.chomp.downcase until (line = gets.chomp) == "END_OF_TEXT" cnt += line.split.find_all{|it| it.downcase == word }.size end puts cnt
[["-", 0, 493, 0, 750, 8, 170, 0, 652, 735, 22], ["+", 0, 493, 0, 750, 8, 170, 0, 755, 31, 22], ["+", 0, 493, 0, 750, 8, 170, 0, 755, 17, 107]]
4
43
w = STDIN.gets.chomp count = 0 while (line = STDIN.gets.chomp) != "END_OF_TEXT" line.split(' ').each {|word| count += 1 if word.casecomp(w) == 0 } end puts count
w = STDIN.gets.chomp count = 0 while (line = STDIN.gets.chomp) != "END_OF_TEXT" line.split(' ').each {|word| count += 1 if word.casecmp(w) == 0 } end puts count
[["-", 8, 734, 0, 751, 15, 738, 31, 652, 735, 22], ["+", 8, 734, 0, 751, 15, 738, 31, 652, 735, 22]]
4
54
w=input() c=0 while True: t=input().lower() if t=='END_OF_TEXT': print(c) break c+=t.lower().split().count(w)
w=input() c=0 while True: t=input() if t=='END_OF_TEXT': print(c) break c+=t.lower().split().count(w)
[["-", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
48
import sys s = input().lower() t = sys.stdin.read().lower().split() print(t) print(t.count(s))
import sys s = input().lower() t = sys.stdin.read().lower().split() print(t.count(s))
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 63, 319, 500, 22]]
5
41
import sys word = input().lower() text = sys.stdin.read() text = text.lower() print(text.count(word))
import sys word = input().lower() text = sys.stdin.read() text = text.lower() print(text.split().count(word))
[["+", 0, 652, 63, 319, 500, 652, 63, 319, 319, 22], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131]]
5
36
from sys import stdin import re W = stdin.readline().rstrip() T = stdin.read().replace("END_OF_TEXT", ".").lower() T = re.split(",|\n| ", T) print(T) print(len([x for x in T if x == W]))
from sys import stdin import re W = stdin.readline().rstrip() T = stdin.read().replace("END_OF_TEXT", ".").lower() T = re.split(",|\n| ", T) print(len([x for x in T if x == W]))
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
74
import re pattern = str(input()) words = [] while True: line = str(input()) if line == 'END_OF_TEXT': break words += line.split() cnt = 0 for word in words: if re.fullmatch(pattern, word): cnt += 1 print(cnt)
import re pattern = str(input()) words = [] while True: line = str(input()) if line == 'END_OF_TEXT': break words += line.split() cnt = 0 for word in words: if re.fullmatch(pattern, word.lower()): cnt += 1 print(cnt)
[["+", 15, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 15, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 15, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 57, 15, 652, 3, 4, 0, 25]]
5
65
import re pattern = str(input()) words = [] while True: line = str(input()) if line == 'END_OF_TEXT': break words += line.split() cnt = 0 for word in words: if re.fullmatch(pattern, word): cnt += 1 print(cnt)
import re pattern = str(input()) words = [] while True: line = str(input()) if line == 'END_OF_TEXT': break words += line.lower().split() cnt = 0 for word in words: if re.fullmatch(pattern, word): cnt += 1 print(cnt)
[["+", 12, 652, 63, 319, 500, 652, 63, 319, 319, 22], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 677, 12, 652, 63, 319, 0, 131]]
5
65
w=input() num=0 while True: t=input() if t=='END_OF_TEXT': break else: s=t.split() for i in s: if i==w: num+=1 print(num)
w=input() num=0 while True: t=input() if t=='END_OF_TEXT': break else: s=t.lower().split() for i in s: if i==w: num+=1 print(num)
[["+", 12, 652, 63, 319, 500, 652, 63, 319, 319, 22], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131]]
5
50
def count_unit(ss,pp): count = 0 for i in lst: if ss == i: count = count + 1 return count s = str(input()) sum = 0 while True: lst = list(map(str, input().split())) if lst[0] == "END_OF_TEXT": print(sum) break else: sum += count_unit(s,lst)
def count_unit(ss,pp): count = 0 for i in lst: if ss == i.lower(): count = count + 1 return count s = str(input()) sum = 0 while True: lst = list(map(str, input().split())) if lst[0] == "END_OF_TEXT": print(sum) break else: sum += count_unit(s,lst)
[["+", 0, 57, 15, 666, 0, 652, 63, 319, 0, 131], ["+", 0, 57, 15, 666, 0, 652, 63, 319, 319, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25]]
5
84
W=input() Ti=[] count=0 while True: T=input() s=T.lower() if T=="END_OF_TEXT": break Ti += list(s.split()) for i in range(len(Ti)): if Ti[i]==W: count +=1 print(Ti) print(count)
W=input() Ti=[] count=0 while True: T=input() s=T.lower() if T=="END_OF_TEXT": break Ti += list(s.split()) for i in range(len(Ti)): if Ti[i]==W: count +=1 print(count)
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
75
target = input() count = 0 while True: line = input().lower if line == 'END_OF_TEXT': break for word in line.split(): if word.lower == target.lower: count += 1 print(count)
target = input() count = 0 while True: line = input() if line == 'END_OF_TEXT': break for word in line.split(): if word.lower() == target.lower(): count += 1 print(count)
[["-", 8, 196, 0, 1, 0, 662, 12, 319, 0, 131], ["-", 8, 196, 0, 1, 0, 662, 12, 319, 319, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25]]
5
51
#coding:utf-8 #1_9_A 2015.4.10 w = input().lower() c = 0 while True: t = input() if 'END_OF_TEXT' in t: break c += t.lower().count(w) print(c)
#coding:utf-8 #1_9_A 2015.4.12 w = input().lower() c = 0 while True: t = input() if 'END_OF_TEXT' in t: break c += t.lower().split().count(w) print(c)
[["+", 12, 652, 63, 319, 500, 652, 63, 319, 319, 22], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 677, 12, 652, 63, 319, 0, 131]]
5
46
target = input() count = 0 while True: line = input() if line == 'END_OF_TEXT': break if line[-1] == '.': line = line[:-1] for word in line.lower().split(): if target in word: count += 1 print(count)
target = input() count = 0 while True: line = input() if line == 'END_OF_TEXT': break if line[-1] == '.': line = line[:-1] for word in line.lower().split(): if target == word: count += 1 print(count)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 267], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60]]
5
68
w, count = input(), 0 while True: line = input() if line == 'END_OF_TEXT': break count += line.split().count(w) print(count)
w, count = input(), 0 while True: line = input() if line == 'END_OF_TEXT': break count += line.lower().split().count(w) print(count)
[["+", 500, 652, 63, 319, 500, 652, 63, 319, 319, 22], ["+", 500, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 500, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 12, 652, 63, 319, 500, 652, 63, 319, 0, 131]]
5
41
w = input().casefold() word_count = 0 while True: line = input() if line == "END_OF_TEXT": break word = line.casefold() word = line.split() word_count += word.count(w) print(word_count)
w = input().casefold() word_count = 0 while True: line = input() if line == "END_OF_TEXT": break line = line.casefold() word = line.split() word_count += word.count(w) print(word_count)
[["-", 0, 52, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 31, 22]]
5
54
import sys import math def str_input(): S = input() if S[len(S)-1] == "\r": return S[:len(S)-1] return S W = str_input() cnt = 0 while True: S = str_input() if (S == "END_OF_TEXT"): break S = S.lower() cnt += S.count(W) print(cnt)
import sys import math def str_input(): S = input() if S[len(S)-1] == "\r": return S[:len(S)-1] return S W = str_input() cnt = 0 while True: S = str_input() if (S == "END_OF_TEXT"): break S = S.lower().split() cnt += S.count(W) print(cnt)
[["+", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
87
import sys match = input().lower() s = str() for line in sys.stdin: s += line.lower() print(s.count(match))
import sys match = input().lower() s = str() for line in sys.stdin: s += line.lower() print(s.split().count(match))
[["+", 0, 652, 63, 319, 500, 652, 63, 319, 319, 22], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131]]
5
39
W = input() count = 0 while True: line = input() if line == 'END_OF_TEXT': break for s in line.split(): if s == W: count += 1 print(count)
W = input() count = 0 while True: line = input() if line == 'END_OF_TEXT': break for s in line.lower().split(): if s == W: count += 1 print(count)
[["+", 12, 652, 63, 319, 500, 652, 63, 319, 319, 22], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 7, 12, 652, 63, 319, 0, 131]]
5
45
W = input() while True: line = input() if line == 'END_OF_TEXT': break for s in line.lower().split(): if s == W: count += 1 print(count)
W = input() count = 0 while True: line = input() if line == 'END_OF_TEXT': break for s in line.lower().split(): if s == W: count += 1 print(count)
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
46
W = input() count = 0 while True: line = input() if line == 'END_OF_TEXT': break for s in line.lower.split(): if s == W: count += 1 print(count)
W = input().lower() count = 0 while True: line = input() if line == 'END_OF_TEXT': break for s in line.lower().split(): if s == W: count += 1 print(count)
[["+", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 25]]
5
47
w = input().lower() t = [] while True: s = input() if s == "END_OF_TEXT": break for word in s.split(): t.append(word) print(t.count(w))
w = input().lower() t = [] while True: s = input() if s == "END_OF_TEXT": break for word in s.lower().split(): t.append(word) print(t.count(w))
[["+", 12, 652, 63, 319, 500, 652, 63, 319, 319, 22], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 7, 12, 652, 63, 319, 0, 131]]
5
53
import sys w = input() s = [] cnt = 0 for i in sys.stdin.readlines(): if i == 'END_OF_TEXT\n': break for j in [x.strip('.') for x in i.split()]: s.append(j) for i in s: if w == i: cnt += 1 print(cnt)
import sys w = input() s = [] cnt = 0 for i in sys.stdin.readlines(): if i == 'END_OF_TEXT\n': break for j in [x.strip('.').lower() for x in i.split()]: s.append(j) for i in s: if w == i: cnt += 1 print(cnt)
[["+", 0, 7, 12, 658, 8, 652, 63, 319, 0, 131], ["+", 0, 7, 12, 658, 8, 652, 63, 319, 319, 22], ["+", 0, 7, 12, 658, 8, 652, 3, 4, 0, 24], ["+", 0, 7, 12, 658, 8, 652, 3, 4, 0, 25]]
5
79
W = input() num = 0 for line in input(): if line == 'END_OF_TEXT': break for word in line.split(): if word.lower() == W.lower(): num += 1 print(num)
W = input() num = 0 while True: line = input() if line == 'END_OF_TEXT': break for word in line.split(): if word.lower() == W.lower(): num += 1 print(num)
[["-", 36, 36, 36, 36, 0, 656, 0, 7, 0, 88], ["+", 36, 36, 36, 36, 0, 656, 0, 52, 0, 89], ["+", 36, 36, 36, 36, 0, 656, 0, 52, 15, 146], ["+", 36, 36, 36, 36, 0, 656, 0, 52, 0, 102], ["-", 36, 36, 36, 36, 0, 656, 0, 7, 0, 267], ["+", 0, 52, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 36, 36, 36, 36, 0, 656, 0, 7, 0, 102]]
5
52
import sys w = sys.stdin.readline().strip().lower() cnt = 0 while True: line = sys.stdin.readline().strip() if line == 'END_OF_TEXT': break words = line.split(' ') for i in words: if i == w: cnt += 1 print(cnt)
import sys w = sys.stdin.readline().strip().lower() cnt = 0 while True: line = sys.stdin.readline().strip() if line == 'END_OF_TEXT': break words = line.split(' ') for i in words: if i.lower() == w: cnt += 1 print(cnt)
[["+", 0, 57, 15, 666, 0, 652, 63, 319, 0, 131], ["+", 0, 57, 15, 666, 0, 652, 63, 319, 319, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 24], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 25]]
5
73
W = input().lower() count = 0 while True: a = input() if a == "END_OF_TEXT": break a = a.lower() a = a.split() for i in range(len(a)): if W in a[i]: count += 1 print(count)
W = input().lower() count = 0 while True: a = input() if a == "END_OF_TEXT": break a = a.lower() a = a.split() for i in range(len(a)): if W == a[i]: count += 1 print(count)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 267], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60]]
5
68
import sys w = input() print(sys.stdin.read().lower().count(w))
import sys w = input() print(sys.stdin.read().lower().split().count(w))
[["+", 0, 652, 63, 319, 500, 652, 63, 319, 319, 22], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131]]
5
26
word = input().lower count = 0 while True: line = input() if line == "END_OF_TEXT": break words = line.lower().split() for w in words: if w == word: count += 1 print(count)
word = input().lower() count = 0 while True: line = input() if line == "END_OF_TEXT": break words = line.lower().split() for w in words: if w == word: count += 1 print(count)
[["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
54
word = input() counter = 0 while 1: s = input() if s == 'END_OF_TEXT': break else: s = list(s.split()) counter += s.count(word) counter += s.count(word + '.') print(counter)
word = input() counter = 0 while 1: s = input() if s == 'END_OF_TEXT': break else: s = list(s.lower().split()) counter += s.count(word) counter += s.count(word + '.') print(counter)
[["+", 0, 652, 63, 319, 500, 652, 63, 319, 319, 22], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 0, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 12, 652, 3, 4, 0, 652, 63, 319, 0, 131]]
5
60
import sys w=input().upper() c=0 for s in sys.stdin: if "END_OF_TEXT" in s: break c += str(s).upper().count(w) print(c)
import sys w=input().upper() c=0 for s in sys.stdin: if "END_OF_TEXT" in s: break c += str(s).upper().split().count(w) print(c)
[["+", 12, 652, 63, 319, 500, 652, 63, 319, 319, 22], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 24], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 677, 12, 652, 63, 319, 0, 131]]
5
48