URI Online Judge Solution | 1332 One-Two-Three | UVA 12289

Reference: https://github.com/deniscostadsc/playground/blob/master/uri/1332/1332.cpp

using namespace std;

int main()
    int n;
    char s[6];

        }else if((s[0]=='t' && s[1]=='w')||(s[0]=='t'&&s[2]=='o')||(s[1]=='w'&&s[2]=='o')){

    return 0;


Here we have to think like a child :D….So first we took a character array where we will take input string.And if the input is = 5 then it will print three as per the input set.And then when we enter the value input like ‘t’ and ‘o’ and ‘w’ then we can make it out from the string.So we have added this like this if t and w or if t or o or w or o is available then we will print 2 in the output where in string array t in the position 1, w is in the position 2, o is in the position 3

So basically the output case 2 we made the condition in the logic.

Note: In logic we must have to follow the sequence of the text One,Two,Three as suppose in two it can be two,too,ooo,owo  and as the input will do at most 100 words.So this steps has been taken 🙂

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published. Required fields are marked *