473,385 Members | 1,356 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,385 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 27150
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;...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.