• Register
Forum Thread
  Posts  
I can't find an error in the Java code (Forums : Development Banter : I can't find an error in the Java code) Locked
Thread Options
Dec 2 2022 Anchor

I wrote the source code for a new application on IOS, when writing there were no errors, but when I ran the code, an error appeared in this place:

var t = readLine()! var s = readLine()! var len_s = s.count var t_lis = Set(t) var c_s = Counter(s) var c_t = Counter(t_lis[len_s]) var c_res = [String: String]() var summ = 0 for e in c_s{ c_res[e] = [c_s[e], min( c_s[e], c_t[e] )] summ += c_res[e][1]} for i in (t.count-s.count) + 1 { if summ == len_s-1{ print(i) break } if t[i]in c_res if c_res[t[i]][1] > 0{ c_res[t[i]][1] -= 1 summ -= 1 } if i+len_s < t.count && t[i+len_s] in c_res if c_res[ t[i+len_s] ][1] < c_res[ t[i+len_s] ][0]{ c_res[ t[i+len_s] ][1] += 1 summ += 1 } else print(-1) } Who can tell what is wrong? And does anyone know a quality service for code analysis? Which could make one code unique across multiple projects. Thanks in advance!

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.