Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,960 --> 00:00:08,640
So in this solution, I will basically take the previous development that we had and I will just modify
2
00:00:08,640 --> 00:00:09,960
it a little bit, OK?
3
00:00:10,500 --> 00:00:20,220
So instead of count of characters, let's say new lines, new lines equals to let's say one word, let's
4
00:00:20,220 --> 00:00:26,090
call it total lines, total lines in a file, we will initialize it to one.
5
00:00:26,580 --> 00:00:28,490
And so what do we have?
6
00:00:28,680 --> 00:00:37,620
We have a file and we want to know how many lines this file has or better say we can say how many new
7
00:00:37,620 --> 00:00:40,470
line characters these file has.
8
00:00:40,740 --> 00:00:47,370
OK, so we will keep up with our previous suggestion to read a character at the time.
9
00:00:48,180 --> 00:00:57,210
And as long as we do so, we will ask if a given character equals to what?
10
00:00:57,570 --> 00:01:02,810
What do you think is the indicator for working with new lines?
11
00:01:02,850 --> 00:01:04,950
What specifies a new line?
12
00:01:05,790 --> 00:01:08,180
You're right, it's the backslash in character.
13
00:01:08,640 --> 00:01:14,760
So if we read from the file a backslash in character, then in this case what we should do, we should
14
00:01:14,760 --> 00:01:18,000
say total lines plus plus.
15
00:01:18,000 --> 00:01:19,290
Oops, I'm here.
16
00:01:20,880 --> 00:01:28,090
So incrementing total lines by one, if we found out that we have a character that equals to backslash
17
00:01:28,100 --> 00:01:37,380
Lashan because as we also already said at the end of each line here, although we cannot see a specific
18
00:01:37,380 --> 00:01:39,240
and explicit backslash end.
19
00:01:39,330 --> 00:01:46,350
But there is we also saw it in the previous video that we worked with, counting the characters.
20
00:01:46,350 --> 00:01:49,120
You've seen that the backslash was there.
21
00:01:49,500 --> 00:01:51,180
So there is a backslash in here.
22
00:01:51,330 --> 00:01:54,340
So whenever we would see a solution, we get to a new line.
23
00:01:54,660 --> 00:02:01,410
So that's what we want to count the number of times we've encountered the backslash and character.
24
00:02:02,300 --> 00:02:06,010
All right, so then we will say the total number.
25
00:02:07,770 --> 00:02:10,830
The total number of lines in these file.
26
00:02:13,760 --> 00:02:14,330
Is.
27
00:02:15,290 --> 00:02:20,840
What is the total number of lines in this file that we specified total lines.
28
00:02:21,170 --> 00:02:23,520
That's eight guys, so build and run it.
29
00:02:23,540 --> 00:02:26,390
Let's see that it works exactly as we expected.
30
00:02:26,390 --> 00:02:28,070
The total number of lines in these file.
31
00:02:28,280 --> 00:02:30,920
Three, we can also modify it.
32
00:02:30,920 --> 00:02:31,220
I don't know.
33
00:02:31,220 --> 00:02:32,390
Let's copy and paste.
34
00:02:32,720 --> 00:02:38,650
And they had a new line, Lolla, and see that now we have like seven lines.
35
00:02:38,660 --> 00:02:42,070
Let's see that it supports also they separate.
36
00:02:42,080 --> 00:02:45,860
So the total number of lines in this file is seven.
37
00:02:46,610 --> 00:02:47,200
Awesome.
38
00:02:47,690 --> 00:02:48,790
Congratulations.
39
00:02:49,100 --> 00:02:49,980
Good job, guys.
40
00:02:50,730 --> 00:02:51,920
So, yeah.
41
00:02:53,040 --> 00:02:54,330
We will move on.
42
00:02:54,660 --> 00:02:55,280
Good luck.
3666
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.