UVA Solution 492 – Pig-Latin – Solution in C,C++

UVA Online Judge Solution 492 – Pig-Latin | Volume 4
UVA Problem Link – 492 – Pig-Latin solve

Problem Name: 492 – Pig-Latin solution
Problem Number : UVA – 492 – Pig-Latin code
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 492 – Pig-Latin Code in CPP:

#include <stdio.h>
char s;
char
stack[1000000];
int
main() {
int
idx = 0;
while
(s = getchar()) {
if
(s == EOF)
break
;
switch
(s) {
case
'a' ... 'z':
stack[idx++] = s;
break
;
case
'A' ... 'Z':
stack[idx++] = s;
break
;
default
:
if
(idx > 0) {
stack[idx] = '';
switch
(stack[0]) {
case
'a':
case
'e':
case
'i':
case
'o':
case
'u':
case
'A':
case
'E':
case
'I':
case
'O':
case
'U':
printf("%say", stack);
break
;
default
:
printf("%s%cay", stack+1, stack[0]);
}

idx = 0;
}

putchar(s);
}
}

return
0;
}

Tags: UVA Online Judge Solution, UVA OJ Solution list, UVA Problems Solution, UVA solver, UVA all problem solution list, UVA 492 – Pig-Latin  code in C, UVA 492 code in C++, UVA 492 – Pig-Latin solution in C, UVA 492 solution

By Maniruzzaman Akash

Maniruzzaman Akash is a freelance web developer with most popular Laravel PHP frameork and Vue JS

Leave a Reply

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