473,394 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

I can't find an error in the Java code

10 Byte
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:
Expand|Select|Wrap|Line Numbers
  1. var t = readLine()!
  2. var s = readLine()!
  3. var len_s = s.count
  4. var t_lis = Set(t)
  5. var c_s   = Counter(s)
  6. var c_t   = Counter(t_lis[len_s])
  7. var c_res = [String: String]()
  8. var summ  = 0
  9. for e in c_s{
  10.     c_res[e] = [c_s[e], min( c_s[e], c_t[e] )]
  11.     summ += c_res[e][1]}
  12. for i in (t.count-s.count) + 1 {
  13.     if summ == len_s-1{
  14.         print(i)
  15.         break
  16.  
  17.     }
  18.     if t[i] in c_res
  19.             if c_res[t[i]][1] > 0{
  20.             c_res[t[i]][1] -= 1
  21.             summ -= 1
  22.     }
  23.     if i+len_s < t.count && t[i+len_s] in c_res
  24.         if c_res[ t[i+len_s] ][1] < c_res[ t[i+len_s] ][0]{
  25.             c_res[ t[i+len_s] ][1] += 1
  26.             summ += 1
  27.  
  28.     }
  29.     else
  30.     print(-1)
  31.         }
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!
Dec 2 '22 #1
4 27162
dev7060
636 Expert 512MB
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:
What error? ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎
Dec 9 '22 #2
HarrySto
10 Byte
@dev7060
The whole part of this code does not work and is highlighted in red, the description of the error is missing
Dec 14 '22 #3
dev7060
636 Expert 512MB
The whole part of this code does not work and is highlighted in red, the description of the error is missing
How do you know the posted code is in Java language? What is the version of JDK? What is the code about? What is highlighted where? What are you doing? What is the environment?
Dec 22 '22 #4
Alpha Teng
1 Bit
This is not Java code!
Jun 27 '23 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Lee | last post by:
The following code generates the error "...not all code paths return a value" but I can't find the problem. I have tried putting "return;" or "return 0;" just after the close of the "if" statement...
1
by: Eric | last post by:
This program is running fine in my office i just copy it and run at home it start given that error and highlight Chr(13). I dont know is this is what the error is or some thing else Compiler...
1
by: niraj | last post by:
I am getting the following error /usr/bin/ld: cant find -lutl Please advice which module i need to install .I am unable to find it . TIA Niraj
2
by: andrewanderson | last post by:
hi can anyone help me with this prog. cant find the prob why it cant display cout<<"This is the display of your transaction"<<endl; ifstream fobj; //declare input file stream ...
4
daniel aristidou
by: daniel aristidou | last post by:
Hi i just downloaded and installed the newest version of java. However i can seem to find or open the files it installed can anyone help me? Or give me a link to download again, maybe the...
6
by: bw171 | last post by:
I got some java code below, and upon trying to compile it in my unix environment, i get the following error ()> javac Downloader.java Downloader.java:37: ';' expected private enum...
11
by: dowlingm815 | last post by:
the following code is generating an error; Mircosoft Access cant find the field '|" referred to in your expression" any suggestions would be appreciated. Private Sub...
0
by: davidson1 | last post by:
Hi, I have ran the below code in java, but it is throwing an NoSuchField error. Can you please help me to correct this code? I have included all the required Jar files and pointed in Environment...
3
by: rutukesh | last post by:
#include<stdio.h> voidmain() { int no_days,months,days; clrscr(); printf("enter number of days:"); scanf("%d",&no_days); months=no_days/30; days=no_days%30;...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.