UVA Solution 454 – Anagrams – UVA Anagram Solution

UVA Onilne Judge Solution UVA-Volume 4

UVA Solution 454 – Anagrams – UVA Anagram Solution

UVA Online Judge Solution 454 – Anagrams | Volume 4
UVA Problem Link – 454 – Anagrams

Problem Name: 454 – Anagrams solution
Problem Number : UVA – 454 – Anagrams solution
Online Judge : UVA Online Judge Solution
Volume: 4
Solution Language : C plus plus

UVA Online Judge Solution, UVA OJ Solution list, UVA Problems Solution, UVA solver, UVA all problem solution list

UVA Solution 454 – Anagrams Code in CPP:

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <algorithm>
#include <iostream>
using namespace std;
int
main() {
int
t;
scanf("%d ", &t);
while
(t--) {
string line[101];
int
idx = 0, word[101][128] = {};
int
i, j;
while
(getline(cin, line[idx])) {
if
(line[idx] == "")
break
;
idx++;
}

sort(line, line+idx);
for
(j = 0; j < idx; j++) {
for
(i = 0; line[j][i]; i++) {
if
(isalpha(line[j][i])) {
word[j][line[j][i]]++;
}
}
}

for
(i = 0; i < idx; i++) {
for
(j = i+1; j < idx; j++) {
if
(!memcmp(word[i], word[j], sizeof(word[i]))) {
printf("%s = %sn", line[i].c_str(), line[j].c_str());
}
}
}

if
(t)
puts("");
}

return
0;
}

Tags: UVA Online Judge Solution, UVA OJ Solution list, UVA Problems Solution, UVA solver, UVA all problem solution list, UVA anagrams code in C, UVA 454  code in C++, UVA 454 – Anagrams  solution in C, UVA anagram code solution

Leave a Reply

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