473,241 Members | 1,534 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,241 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 27020
dev7060
626 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
626 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: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.