271A - Beautiful Year Codeforces || Codeforces 271A - Beautiful Year Solution

Problem Name: 271A Beautiful Year
Judge: Codeforces
Problem link: 271A Beautiful Year
Solution on GitHub: 271A Beautiful Year



Codeforces 271A - Beautiful Year Solution in C++/Cpp

#include <iostream>
#include <string>

using namespace std;

int main() {
    int year;
    cin >> year;
    while (true) {
        int count = 0;
        year = year + 1;
        string s = to_string(year);
        int len = s.length();
        for (int i = 0; i < len - 1; i++) {
            for (int j =  i + 1; j < len; j++) {
                if (s[i] != s[j]) {
                    //do nothing
                }
                else {
                    count++;
                }
            }
        }
        if (count == 0) {
            cout << year << "\n";
            break;
        }
        else {
            continue;
        }
    }

    return 0;
}







Tags: Codeforces 271A - Beautiful Year solution in C C++, 271A codeforces solution in C C++, Codeforces 271A solution in C C++, Codeforces Beautiful Year solution in C C++, 271A - Beautiful Year Codeforces solution in C C++, Codeforces 271A - Beautiful Year solution in C C++

Next Post Previous Post
No Comment
Add Comment
comment url