 Alright guys, so today we're gonna go over the next problem a little bit on Spodge called Abyss, I'm not gonna read this, no one has the time to read about Jimmy and his pupil schools so let's just jump right into it. Basically you have a number of test cases you have to read and then you have these, this numbers, you have numbers, kind of like statements, it's kind of like two plus two equals four, three plus two equals five, stuff like that. So that's what you have in the input statement. So you have, in this case, we have 23 plus 47 equals matriola, okay, so we have 23 plus 47 equals matriola and then our job is basically to just replace whichever string here with the actual number for the correct value of what you have in your input statement. So in this case, 23 plus 47 is equal to matriola. We know matriola is not the actual right value of 23 plus 47, so we're gonna actually just replace matriola with the actual value of 43 plus 47, which is 70, okay? So that's what we output 23 plus 47 is equal to 70, okay? So that's basically the gist of this whole problem, okay? So then for the next line, we have 3,247 plus this weird string is equal to 3,749, right? So in this case, this string is not actually the right value, right? The middle string. So what we're gonna actually do is we're gonna take the rightmost value, this rightmost value and subtract it from the first value that we're supposed to add and then we print the, we replace it with the actual right number. So in this case, the output becomes 3247 plus 502 is equal to 3749, okay? And then the third statement, we have matriola 13 plus 75,425 is equal to 77,038. So in this case, this first statement here is not a number, matriola 13, right? So we're gonna actually replace it with the right corresponding value that adds up to 75,425 that gets us to the 77,038, right? So what we're gonna do is we're actually gonna replace the right corresponding value. So that's 1,613 plus 75,425, which equals to 77,038. So basically the gist of this problem is that there is a one, there's one variable that is just not correct, right? There's one part, one string that is not correct, and then what we have to do is just replace it with the actual correct sum of the value, right? So like in this case, third value, this case was not correct. So what we're gonna do is we're gonna actually replace it with the right sum, the right value that adds up to 75,425 that gets us to the 77,038, right? So in this case, this problem basically just boils down to find the wrong value, right? Find the string. Find the value that is not a string. That is a string, right? Find the value that is a string is not a number, and then just take the other two values and add them up. If it's on the far right, if it's on the far right side, then we just add up the first two values. If it's one of the first two numbers, right? If this first number is not the correct value, then we take the right number and subtract from the left number, the first number to get our right value, the corresponding number for this. And if it's on the left side, we just take the right number, this number and subtract by the middle one to get the corresponding one on the left. That's basically the gist of this problem. So I'm actually going to show you guys the code now, because it's my code, by the way. So this is what I got accepted. Let me just take down, close a few of my chats, but okay, so yeah. So this is the gist of the code. So first we read in the number of test cases T, and then for some odd reason on Spodge, we like to add like weird enter statements, like blank lines that don't mean anything for each test case. So because of that, I have to do cn.ignore after I read in number of test cases here, right? So I ignore that line. Okay. So now I do wild T minus minus. So for each test case, I read that then for every single test case, there's always another space, enter space blank line above it. So I have to ignore that. So I have to ignore that for every test case. So I do that again. I do cn.ignore. Okay. Now, in order to get every single number, in this case, right, what I do is I use a get line cn, which reads in as a string. So then for every line, I get a string. So it's a corresponding string for this one, this one, and this one, right? Okay. So that's what I do here. And so what I do here is I need to, what I want to do is I want to break it up by spaces, right? I want to break this string up into spaces because I want to actually get each individual numbers here. So like 23, 47, and then Machula, right? And in this case, I have like three, two, four, seven, this number through the string, and then the far right. So yeah, what I do here for that is in order to break it up by spaces, I create a string stream. So this is a string stream, and I pass in my input, which is my string that I just read. And then I have the string word, okay? So this word is going to represent every single, every single value that is read in that we're splitting by spaces, right? Okay. So it's a string word. Now what I'm going to do is I'm going to have x, y, and z. So x, y, and z just represents every single corresponding number. So in this case, we have 23, 47, and Machula. So in the beginning, I'm going to set them all to negative one, right? And then whenever I read something that's a number, I'm going to set its corresponding value. So it would set like x equal to 23, it would set y equal to 47, and then z would equal to this, right? And whichever number that doesn't actually get set, that number will remain negative one. That's why I make them all negative ones, okay? So the numbers that get set. Then I have an i equals, which is an index. This index just represents like the corresponding number that I'm setting. So like if i is equal to one, I'm going to set x to equal to first number. Then I increment my i by one. So then I'm going to set my y value is going to equal to 47. And then my z value is going to equal to the third one. But in, yeah, but yeah. So that's why I do that there. Anyway, so then what we would do is we do while SS, which is our string stream, right? While we string stream each individual word. So this is going to split it by every single space, right? So every word just now becomes a string. So we have 23, then we have this plus sign, then we have a 47, then we have an equal sign, then we have matrula, right? So that's what it does. That's what this SS word does while SS word. Okay, if each word is a plus sign or an equal sign, then I'm going to ignore it. So I continue to go to the next word. And the reason why is that? Because we just want to focus on the three individual numbers, 23, 47, and then the right value, right? So we don't actually care about the plus sign and we don't care about the equal sign. Because while our string stream reads in a word that splits it by spaces, it also includes the plus sign and equal sign, but we don't really care about that. So that's why I do if the word is equal to a plus sign or it's equal to an equal sign, I continue and I ignore it and I go back to the top. Okay. So this is the part where it gets a little strange. I know the code is a little messy, but this is the part where it kind of gets a little strange. So I use a try catch and the reason why I do that is because the try catch is going to catch of converting the string, each individual string into a number, right? So yeah, that's why I use a try catch for. So in this case, I have another function that is called is number. Here, it just represents the, it's just a function I found online that basically reads in a string and checks if it's an actual number or not. This uses a lambda expression. I'm not going to go over how this works because quite frankly, I don't actually know that much about lambda expressions, but yeah, I've found this on Stack Overflow. You could just pause the video and look at it if you want. Yeah. Okay. So if it's not a number, if my current word is not a number, I'm just going to increment my current I counter and then I continue. That means that I'm going to go to the next number to read. So I have X, Y and Z that represents the every single number, right? Like X is 23, Y would equal to 47, Z would equal to Matrula, right? So if it's not a string, then I just go to the next number, right? I'm going to set the next number to be equal to Y, the next number equals Z, right? So that's why I got to do this I plus plus and I do a continue so I ignore the rest, right? I go to the next one. Okay. Now, otherwise, if it is a number, I'm going to convert it. So that's what this S toll does. S toll converts the string into a variable and I set it equal to value. This try catch would actually catch, try to make sure it works or not, okay? Now I have my value. So now, yeah. In this case, now we have our if statements. So what I'm going to do is I'm going to see if my counter of I is equal to one, then I'm going to set my X value is going to equal to value, then I increment I plus plus. If my counter of my I is equal to two, that means I'm going to set my Y value is equal to the value and then I do I plus plus. If my counter is equal to three, I set my Z value is equal to the value, current value, and I do I plus plus. And this is just make sure that I'm reading like every single value to its corresponding X, Y, and Z. So like in this case, it would set X equal to 23, then it'll set Y equal to 47. And then matrula is not a number, right? Matrula is not a number. So then it just goes to the next one, right? And then we're done. So Z would remain as negative one, right? So in in this, this in the code that I wrote, basically whichever number that is not a word, which is not a number, whichever number is not a number, right? But its corresponding value would remain negative one. So in the next line of test case, we have 3,247, right? So it'll read X as this number. And then this value is not a not a number, right? So Y would remain negative one. And then this value, Z would equal to this value 3,749. That's what Z would equal to. So right? That's what this code does. Okay? All right. In the end, what I do is, if any of the value, I have to check into each individual value. So if one of the value was missing, so like in this case, at the end, if X is equal to negative one, that means X was missing, right? So this value was missing. So what we do is we're going to take, we're going to print Z, the third value, subtract by Y to get our right value, right? Our right value. So in this case, I'll be this third value, right? So that's what I do here. I use the third value minus the second one, because that's going to be our correct X value. And then I print out the plus sign, and then I print out the right, the Y value, right? I print out the second value, and then I print out Z equals. If the second value was missing, right? Second value is equal to negative one. That means that the second value was a string. So this value was a string. So what I'm going to do is I'm going to take my Z, which is the third value, minus the first value to get my second value. So yeah, that's what I do here. So I print out my first value of X, I print out a plus sign, and then I do third value minus this first value, Z minus X, then I have a equal sign, and then I print out the third value. All right, now if the third value is missing, Z is equal to a negative one. That means the third value is missing, so that means this third value is a string, right? So that means it's missing. So what I do is I print out X, I print out Y, which is I print out the first value, which is 23. I print out Y, which is the second value, which is 47. And then I just print out X plus Y, which is 70, 23 plus 47 is 70. So that'll print out the actual output. And then at the end, that's just return zero. So that's pretty much the gist of this problem. There's not much to it. You just have to make sure, like you said, you check each individual variable and make sure it's a string or not. It's a number or not. Yeah. You have to check each number and make sure it's a number or not. But yeah, I hope you guys enjoyed this video. Write a comment, subscribe. I'll check you guys later. Peace.